Skip to content

Commit

Permalink
add useragent to R18 scraper
Browse files Browse the repository at this point in the history
  • Loading branch information
zuko7177 committed Sep 18, 2020
1 parent e159e28 commit 77f394f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import moviescraper.doctord.model.dataitem.Trailer;
import moviescraper.doctord.model.dataitem.Votes;
import moviescraper.doctord.model.dataitem.Year;
import moviescraper.doctord.scraper.UserAgent;

public class R18ParsingProfile extends SiteParsingProfile implements SpecificProfile {

Expand Down Expand Up @@ -399,7 +400,7 @@ private SearchResult[] searchResultOnR18(String searchWord) {
searchWordURLEncoded = codec.encode(searchWord);
String searchPattern = "http://www.r18.com/common/search/floor=movies/searchword=" + searchWordURLEncoded + "/";
System.out.println("Searching on R18 with this URL:" + searchPattern);
Document searchResultsPage = Jsoup.connect(searchPattern).timeout(SiteParsingProfile.CONNECTION_TIMEOUT_VALUE).get();
Document searchResultsPage = Jsoup.connect(searchPattern).userAgent(UserAgent.getUserAgent(0)).timeout(SiteParsingProfile.CONNECTION_TIMEOUT_VALUE).get();
Elements moviesFound = searchResultsPage.select(".cmn-list-product01 li");
if (moviesFound != null && moviesFound.size() > 0) {
SearchResult[] foundResults = new SearchResult[moviesFound.size()];
Expand Down

0 comments on commit 77f394f

Please sign in to comment.