Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Scraper 3.0 (formally mega-scraper)
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods in Progress

2020-02-08 00:14:24
Hello. I have today what used to be mega-scraper.php but decided to bring it up to speed this afternoon for the first time. So what this does is scrapes all torrents (with or without metadata, even as little as only info_hash) using our database table of updated trackers for Feb 2020, and scrapes ALL torrents reported as 0 seeds (dead/DHT). I've tested this using a very basic magnet link with no appended trackers at all, converted to .torrent and tested on uTorrent, no trackers or any info at all. So I run the script and scrapes the same torrent not a problem!

This is great if your up against the DHT/PEX issue of no torrent stats from the swarm. This should resolve that, by relying on the info_hash to retrieve updated stats.

This script does need work, but I did make managing it much easier and joined two tables to work with the new tracker table.

TODO: Properly cycle through each tracker PER torrent ID, not just jump to next tracker on next torrent ID (doing the same thing again). This is the only limitation with the script as I am not as advanced as others.

I need people to test this out, report back and be sure to see the script options as well (I left them in for debug purposes).

Enjoy.

Proof of concept:
[URL unfurl="true"]https://www.switch-torrents.com/details/77/[/url]

The link above was (and still is) a dead torrent in terms of trackers. It was a very basic hash converted to .torrent and scraped. If you were to download this torrent, you would see no trackers in uTorrent.

Take care of magnet links

Open torrent-details.php and find this:

print ("<a href=\"magnet:?xt=urn:btih:".$row["info_hash"]."&dn=".$row["filename"]."&tr=udp://tracker.openbittorrent.com&tr=udp://tracker.publicbt.com\"><button type='button' class='btn btn-large btn-primary'>Magnet Download</button></a>");


Replace with this:

print ("<a href=\"magnet:?xt=urn:btih:".$row["info_hash"]."&dn=".$row["filename"]."&tr=".$row["trackers_db"]."><button type='button' class='btn btn-large btn-primary'>Magnet Download</button></a>");


Find this:

$res = SQL_Query_exec("SELECT torrents.anon, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.nfo, torrents.last_action, torrents.numratings, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.external, torrents.image1, torrents.image2, torrents.tags, torrents.youtube, torrents.announce, torrents.numfiles, torrents.freeleech, IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.numratings, categories.name AS cat_name, torrentlang.name AS lang_name, torrentlang.image AS lang_image, categories.parent_cat as cat_parent, trackers.url as trackers_db, users.username, users.privacy, users.avatar FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id LEFT JOIN users ON torrents.owner = users.id LEFT JOIN trackers ON trackers.url = trackers.url WHERE torrents.id = $id");


Replace with:

$res = SQL_Query_exec("SELECT torrents.anon, torrents.seeders, torrents.banned, torrents.leechers, torrents.info_hash, torrents.filename, torrents.nfo, torrents.last_action, torrents.numratings, torrents.name, torrents.owner, torrents.save_as, torrents.descr, torrents.visible, torrents.size, torrents.added, torrents.views, torrents.hits, torrents.times_completed, torrents.id, torrents.type, torrents.external, torrents.image1, torrents.image2, torrents.tags, torrents.youtube, torrents.announce, torrents.numfiles, torrents.freeleech, IF(torrents.numratings < 2, NULL, ROUND(torrents.ratingsum / torrents.numratings, 1)) AS rating, torrents.numratings, categories.name AS cat_name, torrentlang.name AS lang_name, torrentlang.image AS lang_image, categories.parent_cat as cat_parent, trackers.url as trackers_db, users.username, users.privacy, users.avatar FROM torrents LEFT JOIN categories ON torrents.category = categories.id LEFT JOIN torrentlang ON torrents.torrentlang = torrentlang.id LEFT JOIN users ON torrents.owner = users.id LEFT JOIN trackers ON trackers.url = trackers.url WHERE torrents.id = $id");
ttscraper.3.0.zip
Download
2020-02-10 16:20:33
which other files do you use for scrape, scraper and maybe a class in backend, never allowed external torrents but ill give this a test (y)
this is a current work in progress for megascrape so you know what files people have https://www.torrenttrader.xyz/index.php?threads/scrape-udp-trackers.9795/
theres a sql function in there (mysql_fetch_array) for v3 needs to be sqli
2020-02-10 17:52:26
"m-jay, post: 67859, member: 20288":

which other files do you use for scrape, scraper and maybe a class in backend, never allowed external torrents but ill give this a test (y)
this is a current work in progress for megascrape so you know what files people have https://www.torrenttrader.xyz/index.php?threads/scrape-udp-trackers.9795/
theres a sql function in there (mysql_fetch_array) for v3 needs to be sqli


This is based on the changes from that link. I’ve updated this scraper since. Still need testers as 95% of my torrents are tracker-less.
2020-02-10 17:57:04
I'll test :D I'll add the mod to my test site
2020-02-10 18:23:20
"m-jay, post: 67861, member: 20288":

I'll test :D I'll add the mod to my test site


Much appreciated!
Unknown User
2020-02-11 00:19:43
I think the best way of scraping torrents is to add a scraper which will automatically run when someone opens torrent if it didn't scrape torrent for lets say 10 hours.

Like

if (strtotime($row['last_updated']) > strtotime('-10 hours'))
{
run scraping tool without get request
}
2020-02-11 17:29:34
"shadows, post: 67864, member: 20311":

I think the best way of scraping torrents is to add a scraper which will automatically run when someone opens torrent if it didn't scrape torrent for lets say 10 hours.

Like

if (strtotime($row['last_updated']) > strtotime('-10 hours'))
{
run scraping tool without get request
}


I believe this can be easily done with a Ajax call, nice tip!
Unknown User
2020-02-20 20:31:22
The optimal strategy would be to rewrite the script from scratch.

All the versions of megascrape do the same thing, load a .torrent obtain the trackers and try to obtain the stats for each.

Let's say we have 10,000 torrents and all those torrents have at least ten trackers then it's safe to say the number of requests that need to be made is basic maths of 10000 x 10 = 100,000

Those 100,000 requests on a small machine going to take some considerable time and in most cases the cron will start to overlap which means you end up having multiple processes running the same cron.

The best approach for v2.08+ would be:

1.) Obtain a distinct list of trackers from the announce table and have these cached for at least 1 hour.

2.) Iterate through the cached tracker list and call the database to find out the infohashes that use the specific tracker so you would end up getting an array like:

[TABLE]
[TR]
[TD][/TD]

[TD]Array[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]([/TD]
[/TR]
[TR]
[TD][/TD]

[TD]    [udp://9.rarbg.to:2710/announce] => Array[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]        ([/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [0] => 6503b9aacdc6a785d82c528eefb48e81168bdf85[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [1] => 0e5e6e30a4ebabd2db230dccae867dad1307abe4[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [2] => 6b87cfe72e81dfe4c22e39b7f6050d157a7a7523[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [3] => 42bdef23779189520c51a2e2255b6963545c229f[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [4] => b7cf82e7035d9deeed0058f741dd105f5f4efdd1[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [5] => 62857d5ad6f3fe449f677e2771769a465e467ab6[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [6] => 1b17c23b9de47f14228c987e50d5ef75b1bd365b[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [7] => 2493f55acc6d63ebc25e0e06f421d0c9db15dc51[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [8] => f4236b1f2d121ad56400b1010030feb2568a45ad[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [9] => edf6627fabd7f5421f876aa409b754ee04c71546[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [10] => a5e2ff8caa12942544c29bd0244b85d1b73b46b6[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [11] => 76779f8388628f582faf346ac531d07c9521a1dc[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [12] => 74ef016eaa829c92ea7b7261f163a60ab1e6bd96[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [13] => 3c8e66b8a04f963caa6c3a1a68a4e28b3ec749eb[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [14] => 19456ab9eb58026ab2a34d8d12a1c58f97d30104[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [15] => 1821b88d40f99cf0681da48f2a262ff834bc3f42[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [16] => 80801b23373b719838d392e1e35607d6c15ee60e[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [17] => 14ad6188fc8ea3feebbb7808ed46ef61fc495e15[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]        )[/TD]
[/TR]
[TR]
[TD][/TD]

[TD][/TD]
[/TR]
[TR]
[TD][/TD]

[TD]    [udp://tracker.coppersurfer.tk:6969/announce] => Array[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]        ([/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [0] => 6503b9aacdc6a785d82c528eefb48e81168bdf85[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [1] => 0e5e6e30a4ebabd2db230dccae867dad1307abe4[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [2] => 6b87cfe72e81dfe4c22e39b7f6050d157a7a7523[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [3] => 42bdef23779189520c51a2e2255b6963545c229f[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [4] => b7cf82e7035d9deeed0058f741dd105f5f4efdd1[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [5] => 62857d5ad6f3fe449f677e2771769a465e467ab6[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [6] => 1b17c23b9de47f14228c987e50d5ef75b1bd365b[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [7] => 2493f55acc6d63ebc25e0e06f421d0c9db15dc51[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [8] => f4236b1f2d121ad56400b1010030feb2568a45ad[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [9] => edf6627fabd7f5421f876aa409b754ee04c71546[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [10] => a5e2ff8caa12942544c29bd0244b85d1b73b46b6[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [11] => 76779f8388628f582faf346ac531d07c9521a1dc[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [12] => 74ef016eaa829c92ea7b7261f163a60ab1e6bd96[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [13] => 3c8e66b8a04f963caa6c3a1a68a4e28b3ec749eb[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [14] => 19456ab9eb58026ab2a34d8d12a1c58f97d30104[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [15] => 1821b88d40f99cf0681da48f2a262ff834bc3f42[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [16] => 80801b23373b719838d392e1e35607d6c15ee60e[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]            [17] => 14ad6188fc8ea3feebbb7808ed46ef61fc495e15[/TD]
[/TR]
[TR]
[TD][/TD]

[TD]        )[/TD]
[/TR]
[TR]
[TD][/TD]

[TD][/TD]
[/TR]
[TR]
[TD][/TD]

[TD])[/TD]
[/TR]
[TR]
[TD][/TD]

[TD][/TD]
[/TR]
[/TABLE]

Once you have done this you should split the arrays into chunks of 70 and pass them to the udpt scraper which is capable of making multiple requests.
Unknown User
2020-02-21 00:30:48
Or just add the method demonoid is using by implementing iframe which calls torrent and scrapes stats in background when someone opens details page.

There is no point of scraping all torrents, because sooner or later you will have just too many.
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 8
  • Members: 0
  • Guests online: 8
  • Comments: 3
  • Messages: 1,728