Content
Use this format to search for links inside an actual web page.
I recommend that you open the search results in a browser first so you can visually see what you're looking for. Then you can open the URL in something like Postman and find the actual elements containing the data.
weyd uses Jsoup to find elements on the page, but there are some additions I added to the directives for certain situations. If you find that your source needs additional functionality, please submit a ticket or ask on Discord or Telegram.
First, weyd needs to know if this is a source with torrents ("is_torrent": true) or direct downloads ("is_direct": true). Each source can only extract one type, so if you happen to set both to true, weyd will only look for torrent information. If a source does contain both types of links, you should create 2 source JSON files.
Locate links on the page
Now that you have told weyd what page(s) contains the link(s), you need to tell weyd where on the page to find them.
-
"links_container_path" - String (required) - This is a Jsoup selector to get an array of elements that contain links. The smaller you can make this array, the faster your source will be scraped. weyd will need to analyze each and every element in this array. If a page only has 1 link on it (drill-down), then it is best to make this point to the exact HTML element.
- If a page contains many links that are all in <div class="links"><ul><li><div class="link">, then you would probably set this to "div.links div.link" or "div.links > ul > li > div.link" and Jsoup will extract all of the links into an array.
- If a page only contains one link, then it will speed up the process by targeting the actual link. For example, if the link is in <div id="actuallink">, then you would tell Jsoup to look in "div#actuallink", and it will only find one item.
Extract link data
Once we have an array of potential link data, we need to tell weyd how to extract the data we need.
- "magnet_path" - String (required - if is_torrent) - The Jsoup selector to locate either the magnet or the hash within the "links_container_path".
-
"magnet_path_attr" - String (required) - The attribute containing the magnet or the path.
- This may equal |hash| if the HTML element contains the hash. If the hash is stored in an attribute, you will need to add the attribute to the "magnet_path" (see Jsoup Selector documentation).
- If the magnet is the text attribute of the HTML element, this should be an empty string.
- Otherwise, this should contain the attribute name containing the magnet (href for example).
- "link_path" - String (required - if is_direct) - The Jsoup selector to locate the direct download link.
-
"link_path_attr" - String (required) - The attribute containing the link to the direct download
- If the link is inside the text attribute of the HTML element, this should be an empty string.
- Otherwise, this should contain the attribute name containing the magnet. If it is an href pointing to a relative path on this domain, you will need to use "abs:href".
-
"title_path" - String (required) - The Jsoup selector to locate the title of what we're searching. This must match the title of the Show or Movie and contain the Season/Episode information or Year.
- If the Title isn't contained in the "links_container_path", then you can put / in front of the Jsoup directive. For example, if this is a drill_down, and you wanted to extract the title from the <title> HTML element, then you would use "/title".
- If this can also contain the quality info, it will be helpful with the next parts.
-
"title_path_attr" - String (required) - The attribute containing the title.
- If the title is in the text attribute of the HTML element, this should be an empty string.
- Otherwise, this should contain the attribute name containing the title. For example, if the title is found at <div class="title" fulltitle="Title of the item being searched 720p">Title of the item being searched</div>, and you would like to pull the "fulltitle" attribute, you would use "fulltitle".
-
"info_path" - String (required) - This is what is displayed in weyd on the links page. If you prefer display something other than the filename in weyd, you can use this.
- If you wish to use the title, then this should contain |title_path|
- If the "info_path" is located outside the "links_container_path", then you can place / before the Jsoup directive.
-
"info_path_attr" - String (required) - The HTML attribute containing the info to be displayed in weyd's links page.
- If "info_path" contains |title_path| then this should be an empty string.
- If the info is in the text attribute of the HTML element, this should be an empty string.
- Otherwise, this should contain the attribute name containing the info.
-
"quality_path" - String (required) - Jsoup directive to locate a string containing the Quality (720p, 4k, etc).
- If the "title_path" contains this information, you can use |title_path|
- If the link_path" contains this information, you can use |link_path|
-
"quality_path_attr" - String (required) - The HTML attribute containing the text string to be used to match the Quality (720p, 4k, etc).
- If "quality_path" contains |title_path| or |link_path| then this should be an empty string.
- If the quality string is in the text attribute of the HTML element, this should be an empty string.
- Otherwise, this should contain the attribute name containing the quality string.
-
"filesize_path" - String (required) - The Jsoup selector to find the filesize. If the page doesn't have the filesize, this is still required, but can point to a non-numeric string on the page.
- If the size string contains MB or GB, then the size will be calculated. If not, you must use "filesize_units"
-
"filesize_path_attr" - String (required) - The attribute containing the filesize.
- If the filesize is in the text attribute of the HTML element, this should be an empty string.
- Otherwise, this should contain the attribute name containing the filesize.
- if "filesize_path" will return an array of elements, and you want to use the second element in the array, use |next_sibling|
- "filesize_units" - String (optional) - If the page doesn't have MB or GB, you can place that in this element to force weyd to calculate the filesize correctly.
- "seeders_path" - String (required if is_torrent) - Jsoup selector to find the string with the number of seeders. This can point to a non-numeric string on the page if you don't want to pull the seeders from the page.
-
"seeders_path_attr" - String (required) - The attribute containing the seeders.
- If seeders is in the text attribute of the HTML element, this should be an empty string.
- Otherwise, this should contain the attribute name containing the seeders.
- "link_regex" - String (optional - only for is_direct) - To use a regular expression to locate the link instead of "link_path", this will apply that RegEx against the array items in "links_container_path"
-
"title_split_string" - JSON Object (optional) - There may be sources that don't present the "title_path" in a standard format. This is a string that will be used to split out the actual Title to be compared against the Show or Movie.
- "string_format" - String (required) - If the Title presented by the source is "weyd Season 1 Episode 2" instead of "weyd S01E02", you would put "Season %02d Episode %02d" in this element and weyd can correctly match the Title "weyd".
-
"replacement" - Array of String (required) - The replacement values for "string_format"
- "season_int"
- "episode_int"
More Pages
-
"more_pages_indicator" - String (required) - If the source can have multiple pages for a search result, this is the string that indicates there are more pages to find.
- This can be raw HTML. For example, if the "More Pages" is located in the HTML source as <li class="morepages">Next</li>, then that can be the contents of this. This uses Java's String functions to find a match in the entire page, so be specific or you could end up looping through a source indefinitely.
- You can use {ASSUMENEXT} to indicate that there should always be more pages.
- weyd will continue to attempt to pull the next page until the next page is the exact same URL as the current one.
- "next_page_path" - String (optional - required if more_pages_indicator) - Jsoup selector to the HTML element containing a link to the next page.
-
"next_page_attr" - String (optional - required if more_pages_indicator) - The HTML attribute containing the URL to the next page.
- If URL to the next page is in the text attribute of the HTML element, this should be an empty string.
- Otherwise, this should contain the attribute name containing the URL of to the next page. If the URL is in the href, and it is a relative path on the same domain, you must use "abs:href".
Deprecated but required
These directives are deprecated, but they currently must be included in the JSON. Just leave them blank or use |title_path|
- "details_path" - String (required) - May contain a Jsoup path or |title_path| to use what was already used for title.
- "details_path_attr" - String (required) - Should be an empty string.