class HqpornerDownloadThread extends Thread {

		private URL hqpornerVideoPageUrl;
		//private int index;
		private String subdirectory;

		public HqpornerDownloadThread(URL url, int index, String subdirectory) {
			this.hqpornerVideoPageUrl = url;
			//this.index = index;
			this.subdirectory = subdirectory;
		}

		@Override
		public void run() {
			fetchVideo();
		}

		public void fetchVideo() {<FILL_FUNCTION_BODY>}

		private String getVideoFromMyDaddycc(String videoPageUrl) {
			Pattern p = Pattern.compile("(//[a-zA-Z0-9\\.]+/pub/cid/[a-z0-9]+/1080.mp4)");
			try {
				logger.info("Downloading from mydaddy " + videoPageUrl);
				Document page = Http.url(videoPageUrl).referrer(hqpornerVideoPageUrl).get();
				Matcher m = p.matcher(page.html());
				logger.info(page.html());
				if (m.find()) {
					return "https:" + m.group(0);
				}

			} catch (IOException e) {
				logger.error("Unable to get page with video");
			}
			return null;
		}

		private String getVideoFromFlyFlv(String videoPageUrl) {
			try {
				logger.info("Downloading from flyflv " + videoPageUrl);
				Document page = Http.url(videoPageUrl).referrer(hqpornerVideoPageUrl).get();
				String[] videoSizes = { "1080p", "720p", "360p" };
				for (String videoSize : videoSizes) {
					String urlToReturn = page.select("video > source[label=" + videoSize).attr("src");
					if (urlToReturn != null && !urlToReturn.equals("")) {
						return "https:" + urlToReturn;
					}
				}

			} catch (IOException e) {
				logger.error("Unable to get page with video");
			}
			return null;
		}

		private String getVideoFromUnknown(String videoPageurl) {
			// If video host is neither daddycc or flyflv TRY generic way.
			// 1. Search any src$=.mp4
			// 2. Pattern match http(s)://.../../abcd.mp4
			// 3. GET all src link with same host and run 2.

			try {
				logger.info("Trying to download from unknown video host " + videoPageurl);
				URL url = new URL(videoPageurl);
				Response response = Http.url(url).referrer(hqpornerVideoPageUrl).response();
				Document doc = response.parse();

				// 1. Search for src$=.mp4
				Elements endingWithMp4 = doc.select("[src$=.mp4]");
				if (!endingWithMp4.isEmpty()) {
					List<String> list = new ArrayList<>();
					endingWithMp4.forEach((e) -> list.add(e.attr("src")));
					return getBestQualityLink(list);
				}

				// 2. Pattern match https?://somehost.cc/example123/abcd.mp4
				String link = matchUrlByPattern(p3, doc.html());
				if (link != null) {
					return link;
				}

				// 3. GET all src link with same host and run 2.
				link = null;
				Elements allElementsWithSrc = doc.select("[src*=" + url.getHost() + "]"); //all urls from same host.
				allElementsWithSrc = allElementsWithSrc.select("[src~=/[A-Za-z0-9_-]+$]"); // remove links with extensions( .js).
				for (Element e : allElementsWithSrc) {
					Document d = Http.url(e.attr("src")).referrer(url.getHost()).get();
					link = matchUrlByPattern(p3, d.html());
					if (link != null) {
						return link;
					}
				}

			} catch (IOException e) {
				logger.error("Unable to get video url using generic methods.");
			}

			// RIP unknown ripper.
			logger.error("Unable to get video url using generic methods.");
			return null;

		}

		private String matchUrlByPattern(Pattern pattern, String html) {
			// Step 2. function
			Matcher m = pattern.matcher(html);
			List<String> list = new ArrayList<>();
			while (m.find()) {
				list.add(m.group());
			}
			if (!list.isEmpty()) {
				return getBestQualityLink(list);
			}

			return null;
		}

		private String getVideoName() {
			try {
				String filename = getGID(hqpornerVideoPageUrl);
				return filename;
			} catch (MalformedURLException e) {
				return "1080";
			}
		}

	}

			try {

				Document doc = Http.url(hqpornerVideoPageUrl).retries(3).get();
				String downloadUrl = null;
				String videoPageUrl = "https:" + doc.select("div.videoWrapper > iframe").attr("src");

				if (videoPageUrl.contains("mydaddy")) {
					downloadUrl = getVideoFromMyDaddycc(videoPageUrl);
				} else if (videoPageUrl.contains("flyflv")) {
					downloadUrl = getVideoFromFlyFlv(videoPageUrl);
				} else {
					//trying a generic selector to grab video url.
					downloadUrl = getVideoFromUnknown(videoPageUrl);
				}

				if (downloadUrl != null) {
					addURLToDownload(new URL(downloadUrl), "", subdirectory, "", null, getVideoName(), "mp4");
				}

			} catch (IOException e) {
				LOGGER.error("[!] Exception while downloading video.", e);
			}
		
<methods>public boolean addURLToDownload(java.net.URL, java.io.File, java.lang.String, Map<java.lang.String,java.lang.String>, java.lang.Boolean) ,public boolean addURLToDownload(java.net.URL, java.io.File) ,public boolean canRip(java.net.URL) ,public void downloadCompleted(java.net.URL, java.io.File) ,public void downloadErrored(java.net.URL, java.lang.String) ,public void downloadExists(java.net.URL, java.io.File) ,public int getCompletionPercentage() ,public int getCount() ,public abstract java.lang.String getHost() ,public Document getNextPage(Document) throws java.io.IOException,public java.lang.String getStatusText() ,public void rip() throws java.io.IOException,public java.net.URL sanitizeURL(java.net.URL) throws java.net.MalformedURLException,public boolean saveText(java.net.URL, java.lang.String, java.lang.String, int) ,public void setWorkingDir(java.net.URL) throws java.io.IOException<variables>private Map<java.net.URL,java.io.File> itemsCompleted,private Map<java.net.URL,java.lang.String> itemsErrored,private Map<java.net.URL,java.io.File> itemsPending