mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2025-12-26 04:48:05 +08:00
更新代码
This commit is contained in:
parent
250139be3c
commit
780c42f9b8
@ -1,8 +1,13 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class Download:
|
||||
def __init__(
|
||||
self,
|
||||
path,
|
||||
headers: dict,
|
||||
proxies=None, ):
|
||||
self.root = Path(path)
|
||||
self.headers = headers
|
||||
self.proxies = {
|
||||
"http": proxies,
|
||||
|
||||
@ -5,7 +5,7 @@ class Image:
|
||||
IMAGE_API = "https://sns-img-qc.xhscdn.com/"
|
||||
IMAGE_ID = compile(r'"traceId":"(.*?)"')
|
||||
|
||||
def __init__(self, html: str):
|
||||
def __init__(self, html):
|
||||
self.html = html
|
||||
|
||||
def get_image_link(self, url: str, download: bool):
|
||||
|
||||
@ -4,7 +4,7 @@ from re import compile
|
||||
class Video:
|
||||
VIDEO_ID = compile(r'"masterUrl":"(.*?)"')
|
||||
|
||||
def __init__(self, html: str):
|
||||
def __init__(self, html):
|
||||
self.html = html
|
||||
|
||||
def get_video_link(self, url: str, download: bool):
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
from .Download import Download
|
||||
from .Html import Html
|
||||
from .Image import Image
|
||||
from .Params import Params
|
||||
from .Video import Video
|
||||
|
||||
HEADERS = {
|
||||
@ -11,10 +11,10 @@ HEADERS = {
|
||||
|
||||
class XHS:
|
||||
def __init__(self, path="./", headers=None, proxies=None, timeout=10):
|
||||
self.params = Params(path)
|
||||
self.html = Html(headers or HEADERS, proxies, timeout)
|
||||
self.image = Image(self.html, self.params)
|
||||
self.video = Video(self.html, self.params)
|
||||
self.image = Image(self.html)
|
||||
self.video = Video(self.html)
|
||||
self.download = Download(path, self.html.headers, proxies)
|
||||
self._cookie = ""
|
||||
|
||||
def get_image(self, url: str, download=False):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user