Watch for high-quality digital movie releases without fuss

  • Tutorial


In most cases, high-quality illegal distributions of a movie begin to appear only after a digital release (do not confuse digital releases with premieres in movie theaters), i.e. in VOD services or on Blu-ray. By quality we mean BDRip 1080p, BDRemux and UHD BDRemux, the least is WEB-DL 1080p (most often from iTunes), with Russian-language soundtracks from the licensed Blu-ray edition or from iTunes. And before that, with the distribution of the film, a mess is created with a combination of moss and sawdust, which can mislead the viewer who wants to watch the latest in good quality.

By the way, did you know that some guys recently hacked Apple TV 4K? Now all 4K releases with HDR and Dolby Atmos tracks from iTunes will be online, as the Aquaman (WEB-DL 2160p HDR) release recently hit. The bitrate there is shameful, but better than nothing before the release (UHD) of Blu-ray. The Apple TV box has been cracked for a long time, and iTunes serves as a conveyor supplier of high-quality Dolby Digital 5.1 tracks with Russian dubbing.

ATTENTION! The note deals with illegal content. But there are no links to this illegal content, as well as the illegal content itself.

ATTENTION! Note does not justify the use of illegal content. Illegal content is bad, without any argument.

ATTENTION!The note contains information about the use of two methods of the private KinoPoisk API (/ k / v1 / films / releases / digital and /ios/5.0.0/getKPFilmDetailView), which violate the rules for using the KinoPoisk service. Although various methods from the KinoPoisk API are used in hundreds of programs and on sites outside the rules, this is a formal basis for taking a note from publication upon request.

I made the program from the note (in Python, guaranteed to work on version 3.6.x and older, for example, on the last at the time of publication 3.7.2) for myself for a couple of evenings. I share it, because it may be useful to someone.

The bottom line is ... The program once a day downloads a list of all digital releases for the last 60 days (from KinoPoisk). For each release on rutor, high-quality distributions are sought. rutor is an open torrent tracker with good tagging in distributions. If there are no high-quality distributions yet, then the release is excluded. No copyright or artisanal translations, no Line. Only BDRip 1080p (or BDRip-HEVC 1080p), BDRemux and UHD BDRemux with Russian tracks from a licensed disc or iTunes, or any other official dubbing. In the case when there is no BD yet for the release, links to WEB-DL 1080p and WEB-DL 2160p (most often from iTunes) are displayed. Out of several distributions of the same type, one with a large number of siders is selected (for example, there are two distributions of the same type from two popular release groups at once). All releases are sorted by the arithmetic mean between the rating of KinoPoisk and IMDb. For all releases, information from KinoPoisk is loaded. The program generates convenient HTML, just open a link in the browser and choose which of the new products to see in excellent quality - click on the button and get the current torrent file. You no longer need to sort through and look for the right distribution, to study whether there is already a film with excellent video quality and dubbing - open the page and everything is before your eyes.

Here is an example of the result of 03/13/2019 that you will get (links to torrent files in the example are distorted so as not to violate anything).



Ideally, WEB-DL 1080p and WEB-DL 2160p (SDR, HDR) should be excluded. But the bottom line is that some releases will never be released on Blu-ray, while they are available on iTunes with acceptable quality and high-quality soundtrack. So you can’t refuse WEB-DL 1080p and WEB-DL 2160p. Moreover, Apple fans (owners of Apple TV) consume content of this quality and do not complain. For example:



The program is in Python and can work anywhere - on a computer, on a dedicated server, on a router with software package manager support (for example, OpenWrt or with Entware support), on an iron.

In a note, I will consider the case when the program will spin on a router with Entware support. In my case, Keenetic. It is very simple, convenient and efficient.

Installing the necessary packages on the router


opkg update
opkg install wget ca-certificates mc python3 python3-pip lighttpd-mod-cgi cron

wget is a program for downloading files. It will be needed only for initial setup.
ca-certificates - certificates for wget.
mc - Midnight Commander file manager. It is needed only because of the convenient mcedit editor. If you are used to using another text editor, then mc can not be installed.
python3 is a Python interpreter.
python3-pip is a Python package manager.
lighttpd-mod-cgi - lighttpd web server.
cron - task scheduler.

Download the main program file


mkdir -p /opt/etc/movies
wget --no-check-certificate -O /opt/etc/movies/digitalreleases.py https://raw.githubusercontent.com/Kyrie1965/torrentReleases/master/digitalreleases.py

You can view its contents on GitHub .

The program itself consists of 5 functions:
digitalReleases (days) returns an array with filmID elements, digital releases for the number of days days.
filmDetail (filmID) returns a dictionary with information on the film corresponding to filmID.
rutorLinks (filmID) returns a dictionary with distributions matching filmID.
saveHTML (movies, filePath) generates an HTML file along the path filePath from the movies array.
main () - connects everything together.

In the program itself, if you plan to use it for its intended purpose, you will be interested in only three mutable parameters: DAYS, HTML_SAVE_PATH, SOCKS_IP, SOCKS_PORT. DAYS - how many last days to download digital releases. The default is 60. I will talk about SOCKS_IP, SOCKS_PORT later when it comes to locking bypass. If you want to change the parameters in the program, then open the file in the editor, for example, mcedit, change and save (F2 - save, F10 - exit).

mcedit /opt/etc/movies/digitalreleases.py

Web server configuration and startup


A web server is needed so that devices on the local network through the browser can pick up the generated releases.html file. Open the file /opt/etc/lighttpd/lighttpd.conf :

mcedit /opt/etc/lighttpd/lighttpd.conf

To paste from the buffer, use Shift + Insert, save - F2, exit - F10.

Change the line # server.port = 80 to:

server.port = 81

Launch the web server:

/opt/etc/init.d/S80lighttpd start

Adding a job to cron


Add to cron a task that every day at 6 am will launch digitalreleases.py and generate an actual file with releases.

Open the file / opt / etc / crontab in the editor :

mcedit /opt/etc/crontab

Add at the end (replace root with admin depending on your device):

00 06 * * * root /opt/bin/python3 /opt/etc/movies/digitalreleases.py > /opt/etc/movies/log.txt 2>&1

If you wish, you can comment out all other template tasks. Run cron:

/opt/etc/init.d/S10cron start

Final setting


Run the program manually for the first time so that it generates the file /opt/share/www/releases.html :

python3 /opt/etc/movies/digitalreleases.py



Subsequently, using cron, the releases.html file will be updated once a day automatically.

All is ready! Open the link http://192.168.0.1:81/releases.html in a browser on any device on your local network (replace 192.168.0.1 with the address of your router).



Lock Bypass Addition


The note implies that the site rutor.info is available from your router. If this is not the case, for example, it is blocked, then when executing digitalreleases.py you will receive a message.

It is very simple to solve. If Tor is not already installed on your router, then install it:

opkg update
opkg install tor tor-geoip

If Tor has already been installed, then simply add the line in the configuration file (/ opt / etc / tor / torrc):

SOCKSPort 127.0.0.1:9050

If Tor has not been installed before, then delete the contents of the Tor configuration file:

cat /dev/null > /opt/etc/tor/torrc

Open the Tor configuration file in the editor:

mcedit /opt/etc/tor/torrc

Paste (Shift + Insert) the contents:

User root
PidFile /opt/var/run/tor.pid
ExcludeExitNodes {RU},{UA},{AM},{KG},{BY}
StrictNodes 1
SOCKSPort 127.0.0.1:9050
ExitRelay 0
ExitPolicy reject *:*
ExitPolicy reject6 *:*
GeoIPFile /opt/share/tor/geoip
GeoIPv6File /opt/share/tor/geoip6
DataDirectory /opt/var/lib/tor

Replace root with admin, depending on your device.

Brief configuration description:

  • Exclude output nodes: Russia, Ukraine, Armenia Kyrgyzstan, Belarus.
  • Hang SOCKS proxy to the address 127.0.0.1, port 9050.
  • Deny to be an exit point.

Run / restart Tor:

/opt/etc/init.d/S35tor restart

Now we need to make requests in the rutorLinks function go through a running proxy server. To do this, install the pysocks library:

pip3 install --upgrade pip setuptools
pip3 install pysocks

Open digitalreleases.py and change:

SOCKS_IP = "127.0.0.1"
SOCKS_PORT = 9050

Done, now no problems with rutor locks for the program.

UPD.


03/18/2019:

  • Fixed a bug with incorrect formation of a link to a torrent file, when rutor gives relative links to torrent files, and not absolute ones.
  • Fixed a bug with incorrect registration of siders when distributions of one type are more than two.
  • Added a link to the movie page in KinoPoisk (click on the KinoPoisk rating).
  • Added USE_MAGNET parameter. Using Magnet links instead of links to torrent files - True, False. Default is False.
  • Added SORT_TYPE parameter. Type of the final sort. rating - sort by rating, releaseDate - sort by date of digital release release. Default is rating.


03/19/2019:

  • Fixed a bug when parsing a page with torrents.
  • Added the ability to select sorting by the date the torrents appeared - torrentsDate.
  • Added download of digital releases for an additional 7 days after the current date, as sometimes a digital release appears a little earlier than the official date.


03/21/2019:

  • Fixed accounting and rating display when KinoPoisk rating is not available.


03/22/2019:

  • Added the ability to sort in a browser (using JS): by rating, by digital release date, by torrent release date.


03/22/2019:

  • Added sorting by combined date.


03/26/2019:

  • The new version of the program. So far, in the form of a file with the index "2" digitalreleases2.py. I’m still trying something, but overall it works very well.

    The previous version of the program was unsuitable for other projects. The whole problem is in issuing digital releases from KinoPoisk. Many new films are simply not on this list. Because of this, the task is not implemented by the program.

    In the new version, most of it has been rewritten a new way, only some developments from the previous version have been taken. Improved the principle of selection of quality distributions. Bugs fixed (in the old version they will not be fixed). Already, the result of her work is fully consistent with the task.

    Previously, the list of films was built according to the scheme: Digital releases from KinoPoisk> Search for correspondences on Rutor for each film> Formation of a list of films using KinoPoisk data. In the new version: Search for pre-suitable releases on Rutor and their processing> Formation of a list of films and additional processing of suitable films using the data from KinoPoisk.

    The new version is slower, but the result is worth it.

    The new version requires an additional Beautiful Soup 4 library (otherwise, there are no differences in installation and launch):
    pip3 install beautifulsoup4

    Here is an example of the result of 03/26/2019 (links to torrent files in the example are distorted so as not to violate anything).


03/28/2019 (digitalreleases2.py):

  • Added an additional search for quality distributions on kinozal.tv.

    If the found elements do not have BDRip 1080p (but there is BDRemux) or there is no BDRemux (but there is BDRip 1080p), then an additional search for the necessary high-quality distribution on kinozal.tv will be performed. The search will be performed only with the key USE_MAGNET = True, i.e. The result of this search is magnet links. To enable an additional search on kinozal.tv, you need to specify the parameters KINOZAL_USERNAME and KINOZAL_PASSWORD. Don’t worry, the final file will contain magnet links not related to your account. An account is only necessary in order to access the magnet link on the kinozal.tv website itself.


03/29/2019 (digitalreleases2.py):

  • Added MPAA rating for age (if ratingAgeLimits is missing).
  • Added ARK-TV Studio and Cyrillic accounting (they are very rare in films, but they are found) for releases with Netflix.
  • Minor edits.


04/01/2019 (digitalreleases2.py):

  • Many fixes.


Here, as usual, an example result from 04/01/2019 (the links in the example are distorted so as not to violate anything).

Also popular now: