From b11833335ed1d4589221338e03ad7ec1e0d20c8d Mon Sep 17 00:00:00 2001 From: Commandcracker <49335821+Commandcracker@users.noreply.github.com> Date: Sat, 7 Dec 2024 01:13:38 +0100 Subject: [PATCH] Add Vidmoly --- README.md | 4 ++-- src/gucken/__init__.py | 2 +- src/gucken/hoster/_hosters.py | 16 ++++++++-------- src/gucken/hoster/common.py | 2 +- src/gucken/hoster/vidmoly.py | 16 +++++++++++++--- src/gucken/provider/aniworld.py | 10 +++++----- src/gucken/provider/serienstream.py | 8 ++++---- src/gucken/resources/default_settings.toml | 2 +- 8 files changed, 35 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 2126e3a..23a33c2 100644 --- a/README.md +++ b/README.md @@ -123,10 +123,10 @@ List of supported video hoster. - [x] Vidoza - [x] Doodstream - [x] SpeedFiles -- [x] ~~Streamtape~~ +- [x] Vidmoly +- [x] Streamtape (Removed from AniWorld & SerienStream) - [ ] Filemoon - [ ] Luluvdo -- [ ] Vidmoly ## Player diff --git a/src/gucken/__init__.py b/src/gucken/__init__.py index 70ad689..6faac47 100644 --- a/src/gucken/__init__.py +++ b/src/gucken/__init__.py @@ -1,4 +1,4 @@ import warnings warnings.filterwarnings('ignore', message='Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning') -__version__ = "0.2.5" +__version__ = "0.2.6" diff --git a/src/gucken/hoster/_hosters.py b/src/gucken/hoster/_hosters.py index d6b6377..9b4a593 100644 --- a/src/gucken/hoster/_hosters.py +++ b/src/gucken/hoster/_hosters.py @@ -1,23 +1,23 @@ from textual._two_way_dict import TwoWayDict -from .doodstream import DoodstreamHoster -from .streamtape import StreamtapeHoster from .veo import VOEHoster from .vidoza import VidozaHoster -from .filemoon import FilemoonHoster -from .luluvdo import LuluvdoHoster from .speedfiles import SpeedFilesHoster +from .doodstream import DoodstreamHoster from .vidmoly import VidmolyHoster +from .filemoon import FilemoonHoster +from .luluvdo import LuluvdoHoster +from .streamtape import StreamtapeHoster hoster = TwoWayDict( { - "DS": DoodstreamHoster, - "ST": StreamtapeHoster, "VEO": VOEHoster, "VZ": VidozaHoster, + "SF": SpeedFilesHoster, + "DS": DoodstreamHoster, + "VM": VidmolyHoster, "FM": FilemoonHoster, "LU": LuluvdoHoster, - "SF": SpeedFilesHoster, - "VM": VidmolyHoster + "ST": StreamtapeHoster } ) diff --git a/src/gucken/hoster/common.py b/src/gucken/hoster/common.py index 790c6e8..f59202e 100644 --- a/src/gucken/hoster/common.py +++ b/src/gucken/hoster/common.py @@ -12,7 +12,7 @@ class DirectLink: async def check_is_working(self) -> bool: try: - async with AsyncClient(verify=False) as client: + async with AsyncClient(verify=False, auto_referer=False) as client: response = await client.head( self.url, headers=self.headers ) diff --git a/src/gucken/hoster/vidmoly.py b/src/gucken/hoster/vidmoly.py index 3bb4b11..056aef9 100644 --- a/src/gucken/hoster/vidmoly.py +++ b/src/gucken/hoster/vidmoly.py @@ -1,12 +1,22 @@ +from dataclasses import dataclass from re import compile as re_compile from ..networking import AsyncClient from .common import DirectLink, Hoster -VIDMOLY_PATTERN = re_compile("") +VIDMOLY_PATTERN = re_compile("sources: \[{file:\"(?P.*?)\"}]") -# TODO: WIP !!! + +@dataclass class VidmolyHoster(Hoster): + requires_headers = True + async def get_direct_link(self) -> DirectLink: - return DirectLink("WIP") + async with AsyncClient(verify=False, auto_referer=False) as client: + response = await client.get(self.url) + match = VIDMOLY_PATTERN.search(response.text) + return DirectLink( + url=match.group("url"), + headers={"Referer": "https://vidmoly.to/"} + ) diff --git a/src/gucken/provider/aniworld.py b/src/gucken/provider/aniworld.py index 98f46dd..2544f17 100644 --- a/src/gucken/provider/aniworld.py +++ b/src/gucken/provider/aniworld.py @@ -4,16 +4,16 @@ from typing import Union from bs4 import BeautifulSoup -from ..networking import AsyncClient, AcceptLanguage -from ..hoster.doodstream import DoodstreamHoster -from ..hoster.streamtape import StreamtapeHoster +from ..networking import AsyncClient, AcceptLanguage from ..hoster.veo import VOEHoster from ..hoster.vidoza import VidozaHoster -from ..hoster.filemoon import FilemoonHoster -from ..hoster.luluvdo import LuluvdoHoster from ..hoster.speedfiles import SpeedFilesHoster +from ..hoster.doodstream import DoodstreamHoster from ..hoster.vidmoly import VidmolyHoster +from ..hoster.filemoon import FilemoonHoster +from ..hoster.luluvdo import LuluvdoHoster +from ..hoster.streamtape import StreamtapeHoster from .common import Episode, Hoster, Language, Provider, SearchResult, Series from ..utils import json_loads diff --git a/src/gucken/provider/serienstream.py b/src/gucken/provider/serienstream.py index 0be1d95..0498d81 100644 --- a/src/gucken/provider/serienstream.py +++ b/src/gucken/provider/serienstream.py @@ -6,14 +6,14 @@ from bs4 import BeautifulSoup from ..networking import AcceptLanguage, AsyncClient -from ..hoster.doodstream import DoodstreamHoster -from ..hoster.streamtape import StreamtapeHoster from ..hoster.veo import VOEHoster from ..hoster.vidoza import VidozaHoster -from ..hoster.filemoon import FilemoonHoster -from ..hoster.luluvdo import LuluvdoHoster from ..hoster.speedfiles import SpeedFilesHoster +from ..hoster.doodstream import DoodstreamHoster from ..hoster.vidmoly import VidmolyHoster +from ..hoster.filemoon import FilemoonHoster +from ..hoster.luluvdo import LuluvdoHoster +from ..hoster.streamtape import StreamtapeHoster from .common import Episode, Hoster, Language, Provider, SearchResult, Series from ..utils import json_loads diff --git a/src/gucken/resources/default_settings.toml b/src/gucken/resources/default_settings.toml index 2de7dbc..370ca28 100644 --- a/src/gucken/resources/default_settings.toml +++ b/src/gucken/resources/default_settings.toml @@ -15,9 +15,9 @@ hoster = [ "VZ", "DS", "SF", + "VM", "FM", "LU", - "VM", "ST" ] update_checker = true