


최근에 github에서 Python PPTV 인터페이스를 보았습니다. 누구든지 이 인터페이스의 알고리즘을 PHP로 변환하는 데 도움을 줄 수 있습니까?
<code>#!/usr/bin/env python __all__ = ['pptv_download', 'pptv_download_by_id'] from ..common import * import re import time import urllib from random import random def constructKey(arg): def str2hex(s): r="" for i in s[:8]: t=hex(ord(i))[2:] if len(t)==1: t="0"+t r+=t for i in range(16): r+=hex(int(15*random()))[2:] return r #ABANDONED Because SERVER_KEY is static def getkey(s): #returns 1896220160 l2=[i for i in s] l4=0 l3=0 while l4<len(l2): l5=l2[l4] l6=ord(l5) l7=l6<<((l4%4)*8) l3=l3^l7 l4+=1 return l3 pass def rot(k,b): ##>>> in as3 if k>=0: return k>>b elif k<0: return (2**32+k)>>b pass def lot(k,b): return (k<<b)%(2**32) #WTF? def encrypt(arg1,arg2): delta=2654435769 l3=16; l4=getkey(arg2) #1896220160 l8=[i for i in arg1] l10=l4; l9=[i for i in arg2] l5=lot(l10,8)|rot(l10,24)#101056625 # assert l5==101056625 l6=lot(l10,16)|rot(l10,16)#100692230 # assert 100692230==l6 l7=lot(l10,24)|rot(l10,8) # assert 7407110==l7 l11="" l12=0 l13=ord(l8[l12])<<0 l14=ord(l8[l12+1])<<8 l15=ord(l8[l12+2])<<16 l16=ord(l8[l12+3])<<24 l17=ord(l8[l12+4])<<0 l18=ord(l8[l12+5])<<8 l19=ord(l8[l12+6])<<16 l20=ord(l8[l12+7])<<24 l21=(((0|l13)|l14)|l15)|l16 l22=(((0|l17)|l18)|l19)|l20 l23=0 l24=0 while l24<32: l23=(l23+delta)%(2**32) l33=(lot(l22,4)+l4)%(2**32) l34=(l22+l23)%(2**32) l35=(rot(l22,5)+l5)%(2**32) l36=(l33^l34)^l35 l21=(l21+l36)%(2**32) l37=(lot(l21,4)+l6)%(2**32) l38=(l21+l23)%(2**32) l39=(rot(l21,5))%(2**32) l40=(l39+l7)%(2**32) l41=((l37^l38)%(2**32)^l40)%(2**32) l22=(l22+l41)%(2**32) l24+=1 l11+=chr(rot(l21,0)&0xff) l11+=chr(rot(l21,8)&0xff) l11+=chr(rot(l21,16)&0xff) l11+=chr(rot(l21,24)&0xff) l11+=chr(rot(l22,0)&0xff) l11+=chr(rot(l22,8)&0xff) l11+=chr(rot(l22,16)&0xff) l11+=chr(rot(l22,24)&0xff) return l11 loc1=hex(int(arg))[2:]+(16-len(hex(int(arg))[2:]))*"\x00" SERVER_KEY="qqqqqww"+"\x00"*9 res=encrypt(loc1,SERVER_KEY) return str2hex(res) def pptv_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False): xml = get_html('http://web-play.pptv.com/webplay3-0-%s.xml?type=web.fpp' % id) #vt=3 means vod mode vt=5 means live mode host = r1(r'<sh>([^<>]+)</sh>', xml) k = r1(r'<key expire=[^<>]+>([^<>]+)</key>', xml) rid = r1(r'rid="([^"]+)"', xml) title = r1(r'nm="([^"]+)"', xml) st=r1(r'<st>([^<>]+)</st>',xml)[:-4] st=time.mktime(time.strptime(st))*1000-60*1000-time.time()*1000 st+=time.time()*1000 st=st/1000 key=constructKey(st) pieces = re.findall('<sgm no="(\d+)"[^<>]+fs="(\d+)"', xml) numbers, fs = zip(*pieces) urls=["http://{}/{}/{}?key={}&fpp.ver=1.3.0.4&k={}&type=web.fpp".format(host,i,rid,key,k) for i in range(max(map(int,numbers))+1)] total_size = sum(map(int, fs)) assert rid.endswith('.mp4') print_info(site_info, title, 'mp4', total_size) if not info_only: try: download_urls(urls, title, 'mp4', total_size, output_dir = output_dir, merge = merge) except urllib.error.HTTPError: #for key expired pptv_download_by_id(id, output_dir = output_dir, merge = merge, info_only = info_only) def pptv_download(url, output_dir = '.', merge = True, info_only = False, **kwargs): assert re.match(r'http://v.pptv.com/show/(\w+)\.html$', url) html = get_html(url) id = r1(r'webcfg\s*=\s*{"id":\s*(\d+)', html) assert id pptv_download_by_id(id, output_dir = output_dir, merge = merge, info_only = info_only) </code>
답글 내용:
<code>#!/usr/bin/env python __all__ = ['pptv_download', 'pptv_download_by_id'] from ..common import * import re import time import urllib from random import random def constructKey(arg): def str2hex(s): r="" for i in s[:8]: t=hex(ord(i))[2:] if len(t)==1: t="0"+t r+=t for i in range(16): r+=hex(int(15*random()))[2:] return r #ABANDONED Because SERVER_KEY is static def getkey(s): #returns 1896220160 l2=[i for i in s] l4=0 l3=0 while l4<len(l2): l5=l2[l4] l6=ord(l5) l7=l6<<((l4%4)*8) l3=l3^l7 l4+=1 return l3 pass def rot(k,b): ##>>> in as3 if k>=0: return k>>b elif k<0: return (2**32+k)>>b pass def lot(k,b): return (k<<b)%(2**32) #WTF? def encrypt(arg1,arg2): delta=2654435769 l3=16; l4=getkey(arg2) #1896220160 l8=[i for i in arg1] l10=l4; l9=[i for i in arg2] l5=lot(l10,8)|rot(l10,24)#101056625 # assert l5==101056625 l6=lot(l10,16)|rot(l10,16)#100692230 # assert 100692230==l6 l7=lot(l10,24)|rot(l10,8) # assert 7407110==l7 l11="" l12=0 l13=ord(l8[l12])<<0 l14=ord(l8[l12+1])<<8 l15=ord(l8[l12+2])<<16 l16=ord(l8[l12+3])<<24 l17=ord(l8[l12+4])<<0 l18=ord(l8[l12+5])<<8 l19=ord(l8[l12+6])<<16 l20=ord(l8[l12+7])<<24 l21=(((0|l13)|l14)|l15)|l16 l22=(((0|l17)|l18)|l19)|l20 l23=0 l24=0 while l24<32: l23=(l23+delta)%(2**32) l33=(lot(l22,4)+l4)%(2**32) l34=(l22+l23)%(2**32) l35=(rot(l22,5)+l5)%(2**32) l36=(l33^l34)^l35 l21=(l21+l36)%(2**32) l37=(lot(l21,4)+l6)%(2**32) l38=(l21+l23)%(2**32) l39=(rot(l21,5))%(2**32) l40=(l39+l7)%(2**32) l41=((l37^l38)%(2**32)^l40)%(2**32) l22=(l22+l41)%(2**32) l24+=1 l11+=chr(rot(l21,0)&0xff) l11+=chr(rot(l21,8)&0xff) l11+=chr(rot(l21,16)&0xff) l11+=chr(rot(l21,24)&0xff) l11+=chr(rot(l22,0)&0xff) l11+=chr(rot(l22,8)&0xff) l11+=chr(rot(l22,16)&0xff) l11+=chr(rot(l22,24)&0xff) return l11 loc1=hex(int(arg))[2:]+(16-len(hex(int(arg))[2:]))*"\x00" SERVER_KEY="qqqqqww"+"\x00"*9 res=encrypt(loc1,SERVER_KEY) return str2hex(res) def pptv_download_by_id(id, title = None, output_dir = '.', merge = True, info_only = False): xml = get_html('http://web-play.pptv.com/webplay3-0-%s.xml?type=web.fpp' % id) #vt=3 means vod mode vt=5 means live mode host = r1(r'<sh>([^<>]+)</sh>', xml) k = r1(r'<key expire=[^<>]+>([^<>]+)</key>', xml) rid = r1(r'rid="([^"]+)"', xml) title = r1(r'nm="([^"]+)"', xml) st=r1(r'<st>([^<>]+)</st>',xml)[:-4] st=time.mktime(time.strptime(st))*1000-60*1000-time.time()*1000 st+=time.time()*1000 st=st/1000 key=constructKey(st) pieces = re.findall('<sgm no="(\d+)"[^<>]+fs="(\d+)"', xml) numbers, fs = zip(*pieces) urls=["http://{}/{}/{}?key={}&fpp.ver=1.3.0.4&k={}&type=web.fpp".format(host,i,rid,key,k) for i in range(max(map(int,numbers))+1)] total_size = sum(map(int, fs)) assert rid.endswith('.mp4') print_info(site_info, title, 'mp4', total_size) if not info_only: try: download_urls(urls, title, 'mp4', total_size, output_dir = output_dir, merge = merge) except urllib.error.HTTPError: #for key expired pptv_download_by_id(id, output_dir = output_dir, merge = merge, info_only = info_only) def pptv_download(url, output_dir = '.', merge = True, info_only = False, **kwargs): assert re.match(r'http://v.pptv.com/show/(\w+)\.html$', url) html = get_html(url) id = r1(r'webcfg\s*=\s*{"id":\s*(\d+)', html) assert id pptv_download_by_id(id, output_dir = output_dir, merge = merge, info_only = info_only) </code>

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제











MySQL에는 무료 커뮤니티 버전과 유료 엔터프라이즈 버전이 있습니다. 커뮤니티 버전은 무료로 사용 및 수정할 수 있지만 지원은 제한되어 있으며 안정성이 낮은 응용 프로그램에 적합하며 기술 기능이 강합니다. Enterprise Edition은 안정적이고 신뢰할 수있는 고성능 데이터베이스가 필요하고 지원 비용을 기꺼이 지불하는 응용 프로그램에 대한 포괄적 인 상업적 지원을 제공합니다. 버전을 선택할 때 고려 된 요소에는 응용 프로그램 중요도, 예산 책정 및 기술 기술이 포함됩니다. 완벽한 옵션은없고 가장 적합한 옵션 만 있으므로 특정 상황에 따라 신중하게 선택해야합니다.

MySQL은 기본 데이터 저장 및 관리를위한 네트워크 연결없이 실행할 수 있습니다. 그러나 다른 시스템과의 상호 작용, 원격 액세스 또는 복제 및 클러스터링과 같은 고급 기능을 사용하려면 네트워크 연결이 필요합니다. 또한 보안 측정 (예 : 방화벽), 성능 최적화 (올바른 네트워크 연결 선택) 및 데이터 백업은 인터넷에 연결하는 데 중요합니다.

MySQL 데이터베이스 성능 최적화 안내서 리소스 집약적 응용 프로그램에서 MySQL 데이터베이스는 중요한 역할을 수행하며 대규모 트랜잭션 관리를 담당합니다. 그러나 응용 프로그램 규모가 확장됨에 따라 데이터베이스 성능 병목 현상은 종종 제약이됩니다. 이 기사는 일련의 효과적인 MySQL 성능 최적화 전략을 탐색하여 응용 프로그램이 고 부하에서 효율적이고 반응이 유지되도록합니다. 실제 사례를 결합하여 인덱싱, 쿼리 최적화, 데이터베이스 설계 및 캐싱과 같은 심층적 인 주요 기술을 설명합니다. 1. 데이터베이스 아키텍처 설계 및 최적화 된 데이터베이스 아키텍처는 MySQL 성능 최적화의 초석입니다. 몇 가지 핵심 원칙은 다음과 같습니다. 올바른 데이터 유형을 선택하고 요구 사항을 충족하는 가장 작은 데이터 유형을 선택하면 저장 공간을 절약 할 수있을뿐만 아니라 데이터 처리 속도를 향상시킬 수 있습니다.

해시 값으로 저장되기 때문에 MongoDB 비밀번호를 Navicat을 통해 직접 보는 것은 불가능합니다. 분실 된 비밀번호 검색 방법 : 1. 비밀번호 재설정; 2. 구성 파일 확인 (해시 값이 포함될 수 있음); 3. 코드를 점검하십시오 (암호 하드 코드 메일).

생산 환경의 경우 성능, 신뢰성, 보안 및 확장 성을 포함한 이유로 서버는 일반적으로 MySQL을 실행해야합니다. 서버에는 일반적으로보다 강력한 하드웨어, 중복 구성 및 엄격한 보안 조치가 있습니다. 소규모 저하 애플리케이션의 경우 MySQL이 로컬 컴퓨터에서 실행할 수 있지만 자원 소비, 보안 위험 및 유지 보수 비용은 신중하게 고려되어야합니다. 신뢰성과 보안을 높이려면 MySQL을 클라우드 또는 기타 서버에 배포해야합니다. 적절한 서버 구성을 선택하려면 응용 프로그램 부하 및 데이터 볼륨을 기반으로 평가가 필요합니다.

HADIDB : 가볍고 높은 수준의 확장 가능한 Python 데이터베이스 HadIDB (HADIDB)는 파이썬으로 작성된 경량 데이터베이스이며 확장 수준이 높습니다. PIP 설치를 사용하여 HADIDB 설치 : PIPINSTALLHADIDB 사용자 관리 사용자 만들기 사용자 : createUser () 메소드를 작성하여 새 사용자를 만듭니다. Authentication () 메소드는 사용자의 신원을 인증합니다. Fromhadidb.operationimportuseruser_obj = user ( "admin", "admin") user_obj.

MySQL 데이터베이스에 이미지를 저장하는 것은 가능하지만 모범 사례는 아닙니다. MySQL은 이미지를 저장할 때 Blob 유형을 사용하지만 데이터베이스 볼륨 부기, 쿼리 속도 및 복잡한 백업을 유발할 수 있습니다. 더 나은 솔루션은 파일 시스템에 이미지를 저장하고 데이터베이스에 이미지 경로 만 저장하여 쿼리 성능 및 데이터베이스 볼륨을 최적화하는 것입니다.

아니요, MySQL은 SQL Server에 직접 연결할 수 없습니다. 그러나 다음 방법을 사용하여 데이터 상호 작용을 구현할 수 있습니다. 미들웨어 사용 : MySQL에서 중간 형식으로 데이터를 내보낸 다음 미들웨어를 통해 SQL Server로 가져옵니다. 데이터베이스 링커 사용 : 비즈니스 도구는 본질적으로 미들웨어를 통해 여전히 구현되는보다 우호적 인 인터페이스와 고급 기능을 제공합니다.
