View Single Post
  #17  
Old 15.10.2021, 15:05
pepe3333 pepe3333 is offline
Modem User
 
Join Date: Oct 2021
Posts: 4
Default

pspzockerscene,
could you please briefly explain how does "Try to recognize limit" option work?
Is it checking for ""video-hd-mark" tag or in some other way?

For anyone interested I've made a Python script to check your existing Xvideos library matching original resolution on site and get URLs for redownloading otherwise:
Spoiler:

Code:
import cv2
import os
import re
import urllib3

http = urllib3.PoolManager(maxsize=1, block=True)
directory = r'E:\Music\PMV'
n = 0
dlList = []

def getVideoHeight(path):
    cv2video = cv2.VideoCapture(path)

    return int(cv2video.get(cv2.CAP_PROP_FRAME_HEIGHT))

def processFile(filename, path):
    global http

    match = re.match('(?P<Id>\\d*)_(?P<Name>.*)\\.mp4', filename)

    if not match:
        print('skipping')
        return

    id = match.group('Id')
    name = match.group('Name')

    if not id or not name:
        print('ERROR id or name')
        return

    print('id = ' + id + ', name = "' + name + '", ', end='')

    name = name.replace(' ', '_')
    url = r'**External links are only visible to Support Staff** + id + '/' + name
    print('url = ' + url + ', ', end='')
    r = http.request('GET', url)

    if len(r.data) == 0:
        print('ERROR url')
        return
        
    page = r.data.decode('utf-8')
    hdMarkMatch = re.search('<span class=\\"video-hd-mark\\">(?P<resolution>\\d*)p<\\/span><\\/h2>', page)

    if not hdMarkMatch:
        print('not hi-res, skipping')
        return

    urlHeight = int(hdMarkMatch.group('resolution'))
    print('res = ' + hdMarkMatch.group('resolution') + ', ', end='')

    videoHeight = getVideoHeight(path)
    print('vid res = ' + str(videoHeight) + ', ', end='')

    if videoHeight >= urlHeight:
        print('OK!!!')
        return
    else:
        print('queued for dl.')
        dlList.append(url)

for f in os.listdir(directory):
    path = os.path.join(directory, f)
    if os.path.isfile(path) and f.endswith('.mp4'):
        n = n + 1
        print(str(n) + '. ' + f + ': ', end='')
        processFile(f, path)


print('DL list(' + str(len(dlList)) + '):')

for url in dlList:
    print(url)


or (remove spaces in site name)
pastebin.com/E2aZTeyV

Last edited by pspzockerscene; 15.10.2021 at 16:35.
Reply With Quote