# -*- coding: utf-8 -*- import os import time import urllib from core import httptools from core import scrapertools from lib import jsunpack from platformcode import config, logger def test_video_exists(page_url): logger.info("(page_url='%s')" % page_url) return True, "" def get_video_url(page_url, premium=False, user="", password="", video_password=""): logger.info("url=" + page_url) pfxfx = "" headers = {'Host': 'www.flashx.sx', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'en-US,en;q=0.5', 'Accept-Encoding': 'gzip, deflate, br', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'Cookie': ''} data = httptools.downloadpage(page_url, cookies=False).data data = data.replace("\n","") cgi_counter = scrapertools.find_single_match(data, """(?is)src=.(https://www.flashx.sx/counter.cgi.*?[^(?:'|")]+)""") cgi_counter = cgi_counter.replace("%0A","").replace("%22","") playnow = scrapertools.find_single_match(data, 'https://www.flashx.sx/dl[^"]+') # Para obtener el f y el fxfx js_fxfx = "https://www." + scrapertools.find_single_match(data.replace("//","/"), """(?is)(flashx.sx/js\w+/c\w+.*?[^(?:'|")]+)""") data_fxfx = httptools.downloadpage(js_fxfx).data mfxfx = scrapertools.find_single_match(data_fxfx, 'get.*?({.*?})').replace("'","").replace(" ","") matches = scrapertools.find_multiple_matches(mfxfx, '(\w+):(\w+)') for f, v in matches: pfxfx += f + "=" + v + "&" logger.info("mfxfxfx1= %s" %js_fxfx) logger.info("mfxfxfx2= %s" %pfxfx) if pfxfx == "": pfxfx = "ss=yes&f=fail&fxfx=6" coding_url = 'https://www.flashx.sx/flashx.php?%s' %pfxfx # {f: 'y', fxfx: '6'} bloque = scrapertools.find_single_match(data, '(?s)Form method="POST" action(.*?)