Possible inconsistency in README.md example
mayurdzk opened this issue · comments
Describe the bug
In your README.md you have:
import com.prof.rssparser.Article
import com.prof.rssparser.Parser
//url of RSS feed
private val url = "https://www.androidauthority.com/feed"
coroutineScope.launch(Dispatchers.Main) {
try {
val parser = Parser()
val articleList = parser.getChannel(url)
// Show the channel data
} catch (e: Exception) {
// Handle the exception
}
}
Notice the line here: val parser = Parser()
.
When I try using your library and trying the same code snippet, I get an error from my IDE:
Cannot access class 'okhttp3.OkHttpClient'. Check your module classpath for missing or conflicting dependencies
On inspection it see it's because you expect an OkHTTPCLient
in your constructor (which means I need to set it up as a dependency in my project too?). I don't mind doing this but this would appear the README.md example is misleading?
Let me know if I'm missing out on something--I don't mind filing a PR for a fix, either.
The link of the RSS Feed
None, this isn't a problem with the feed parsing.
By the way, thank you so much for the OSS work here; it saved me tremendous amount of work! 🎉
Thank you!
The okhttp client in the constructor is optional. If you don't provide, the library will create it for you. (btw, I'm planning to improve the README with the next release). You should not provide the dependency, because it is present in the library, as stated in the pom file.
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.12.0</version>
<scope>runtime</scope>
</dependency>