Author Topic: howto: Thread sucker  (Read 731 times)

0 Members and 1 Guest are viewing this topic.

Offline firewaran

  • Moderator
  • *****
  • Joined: Apr 2016
  • Posts: 264
  • Reputation: 18
  • Gender: Male
howto: Thread sucker
« on: May 01, 2016, 02:19 pm »
Hi guys,

i want to share with you the knowledge how to get thread sucker to work.

idThis is like the "host label" and identifies a "thread sucker" entry.
Please keep the same naming convention as it is for "host label".
urlpatternFirst part to activate the thread sucker.
If matching and searchpattern would returning a result url, the entry will be active in the right-click menu.
In case the your solution is not returning something valid the entry will stay disabled.
searchpatternSecond part to activate the thread sucker.
You need to build a url for each page and return it, then this page will be searched for pictures.
The code will be run as many pages you want, depending on what you enter in the dialog boxes.
E.g. first page 1 and last page 3, it will be executed three times to build the page urls.

threadsucker_Globals.linkIndex is the variable we can access to use the current number.
In our example it will be 1 at the first time, 2 for the second run, and 3 for the last run.

let's have a look on an example:
Code: [Select]
<forum id="eroticity">
<searchpattern><![CDATA[function(threadURL) {
    return threadURL.match(/http.+\//) + "page" + (threadsucker_Globals.linkIndex);   

IHG will check the current url to see if urlpattern is matching, if not end of task.
If so the "thread sucker" entry will get active.

If you go on this page:
The "thread sucker" will be active, because the urlpattern is matching.

When you now run the thread sucker and give 1 as first page and 3 as last page it will do the following:

Code: [Select]
threadURL.match(/http.+\//)Get the Url but without the last part, in our case "page2".
Code: [Select]
+ "page"add "page"-text to the url.
Code: [Select]
+ (threadsucker_Globals.linkIndex)Now add the first loop value, in our case 1, because first page is 1.

The function will return:

loop   .   returned url
1   .
2   .
3   .
4   .   We reached our "last page" so IHG will stop generating urls.
Otherwise it would continue until the "last page" has reached.

Please note that which each loop the page-number is increased by 1.
In case there is another number logic for pages, you need to address this within your code.

These links will be visited by IHG and searched for pictures using the rules in host file editor.
After all generated urls have been visited all found pictures will be queued and downloaded by IHG.

After changes in forum_styles.xml it is necessary to restart your browser.
Thank you SenileDog for pointing that out.

I hope this guide helps you!

If you have questions post em here and i try to answer when possible.

Question      .      Answer
-      .      -

Feedback is appreciated :)


P.s. This knowledge is based on my experience with the thread sucker.