mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-06 19:45:24 +00:00
Add other special char, update readme with temux
This commit is contained in:
parent
c0a9fc1e6d
commit
c86d2a8cac
13
README.md
13
README.md
@ -13,9 +13,13 @@ You can chat, help improve this repo, or just hang around for some fun in the **
|
|||||||
* [INSTALLATION](#installation)
|
* [INSTALLATION](#installation)
|
||||||
* [Requirement](#requirement)
|
* [Requirement](#requirement)
|
||||||
* [Usage](#usage)
|
* [Usage](#usage)
|
||||||
|
* [Win 7](https://github.com/Ghost6446/StreamingCommunity_api/wiki/Installation#win-7)
|
||||||
|
* [Termux](https://github.com/Ghost6446/StreamingCommunity_api/wiki/Termux)
|
||||||
* [CONFIGURATION](#Configuration)
|
* [CONFIGURATION](#Configuration)
|
||||||
* [DOCKER](#docker)
|
* [DOCKER](#docker)
|
||||||
* [TUTORIAL](#tutorial)
|
* [TUTORIAL](#tutorial)
|
||||||
|
* [TO DO](#to-do)
|
||||||
|
|
||||||
|
|
||||||
## Requirement
|
## Requirement
|
||||||
|
|
||||||
@ -49,6 +53,7 @@ python run.py
|
|||||||
python3 run.py
|
python3 run.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
You can change some behaviors by tweaking the configuration file.
|
You can change some behaviors by tweaking the configuration file.
|
||||||
@ -164,7 +169,7 @@ You can change some behaviors by tweaking the configuration file.
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> If you're on **Windows** you'll need to use double black slashes. On Linux/MacOS, one slash is fine.
|
> If you're on **Windows** you'll need to use double back slash. On Linux/MacOS, one slash is fine.
|
||||||
|
|
||||||
#### Path examples:
|
#### Path examples:
|
||||||
|
|
||||||
@ -205,3 +210,9 @@ docker run -it -p 8000:8000 -v /path/to/download:/app/Video streaming-community-
|
|||||||
## Tutorial
|
## Tutorial
|
||||||
|
|
||||||
For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing)
|
For a detailed walkthrough, refer to the [video tutorial](https://www.youtube.com/watch?v=Ok7hQCgxqLg&ab_channel=Nothing)
|
||||||
|
|
||||||
|
|
||||||
|
## To do
|
||||||
|
- GUI
|
||||||
|
- Website api
|
||||||
|
- Add other site
|
@ -206,7 +206,7 @@ class Downloader():
|
|||||||
logging.info(f"M3U8 index select: {self.m3u8_index}, with resolution: {video_res}")
|
logging.info(f"M3U8 index select: {self.m3u8_index}, with resolution: {video_res}")
|
||||||
|
|
||||||
# Get URI of the best quality and codecs parameters
|
# Get URI of the best quality and codecs parameters
|
||||||
console.log(f"[cyan]Find resolution [white]=> [red]{list_available_resolution}")
|
console.log(f"[cyan]Find resolution [white]=> [red]{sorted(list_available_resolution, reverse=True)}")
|
||||||
|
|
||||||
# Fix URL if it is not complete with http:\\site_name.domain\...
|
# Fix URL if it is not complete with http:\\site_name.domain\...
|
||||||
if "http" not in self.m3u8_index:
|
if "http" not in self.m3u8_index:
|
||||||
|
@ -175,11 +175,12 @@ class M3U8_Segments:
|
|||||||
|
|
||||||
# Send a GET request to retrieve the index M3U8 file
|
# Send a GET request to retrieve the index M3U8 file
|
||||||
response = requests.get(self.url, headers=headers_index)
|
response = requests.get(self.url, headers=headers_index)
|
||||||
response.raise_for_status() # Raise an exception for HTTP errors
|
response.raise_for_status()
|
||||||
|
|
||||||
# Save the M3U8 file to the temporary folder
|
# Save the M3U8 file to the temporary folder
|
||||||
path_m3u8_file = os.path.join(self.tmp_folder, "playlist.m3u8")
|
if response.ok:
|
||||||
open(path_m3u8_file, "w+").write(response.text)
|
path_m3u8_file = os.path.join(self.tmp_folder, "playlist.m3u8")
|
||||||
|
open(path_m3u8_file, "w+").write(response.text)
|
||||||
|
|
||||||
# Parse the text from the M3U8 index file
|
# Parse the text from the M3U8 index file
|
||||||
self.parse_data(response.text)
|
self.parse_data(response.text)
|
||||||
|
@ -434,8 +434,7 @@ class M3U8_Parser:
|
|||||||
return resolution
|
return resolution
|
||||||
|
|
||||||
# Default resolution return (not best)
|
# Default resolution return (not best)
|
||||||
logging.error("No resolution found with custom parsing.")
|
logging.warning("No resolution found with custom parsing.")
|
||||||
logging.warning("Try set remove duplicate line to TRUE.")
|
|
||||||
return (0, 0)
|
return (0, 0)
|
||||||
|
|
||||||
def __parse_video_info__(self, m3u8_obj) -> None:
|
def __parse_video_info__(self, m3u8_obj) -> None:
|
||||||
@ -449,6 +448,15 @@ class M3U8_Parser:
|
|||||||
try:
|
try:
|
||||||
for playlist in m3u8_obj.playlists:
|
for playlist in m3u8_obj.playlists:
|
||||||
|
|
||||||
|
there_is_codec = not M3U8_Parser.extract_resolution(playlist.uri) == (0,0)
|
||||||
|
|
||||||
|
if there_is_codec:
|
||||||
|
self.codec = M3U8_Codec(
|
||||||
|
playlist.stream_info.bandwidth,
|
||||||
|
None,
|
||||||
|
playlist.stream_info.codecs
|
||||||
|
)
|
||||||
|
|
||||||
# Direct access resolutions in m3u8 obj
|
# Direct access resolutions in m3u8 obj
|
||||||
if playlist.stream_info.resolution is not None:
|
if playlist.stream_info.resolution is not None:
|
||||||
|
|
||||||
@ -456,6 +464,9 @@ class M3U8_Parser:
|
|||||||
"uri": playlist.uri,
|
"uri": playlist.uri,
|
||||||
"resolution": playlist.stream_info.resolution
|
"resolution": playlist.stream_info.resolution
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if there_is_codec:
|
||||||
|
self.codec.resolution = playlist.stream_info.resolution
|
||||||
|
|
||||||
# Find resolutions in uri
|
# Find resolutions in uri
|
||||||
else:
|
else:
|
||||||
@ -465,18 +476,10 @@ class M3U8_Parser:
|
|||||||
"resolution": M3U8_Parser.extract_resolution(playlist.uri)
|
"resolution": M3U8_Parser.extract_resolution(playlist.uri)
|
||||||
})
|
})
|
||||||
|
|
||||||
# Dont stop
|
if there_is_codec:
|
||||||
continue
|
self.codec.resolution = M3U8_Parser.extract_resolution(playlist.uri)
|
||||||
|
|
||||||
# Check if all key is present to create codec
|
continue
|
||||||
try:
|
|
||||||
self.codec = M3U8_Codec(
|
|
||||||
playlist.stream_info.bandwidth,
|
|
||||||
playlist.stream_info.resolution,
|
|
||||||
playlist.stream_info.codecs
|
|
||||||
)
|
|
||||||
except:
|
|
||||||
logging.error(f"Error parsing codec: {e}")
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Error parsing video info: {e}")
|
logging.error(f"Error parsing video info: {e}")
|
||||||
|
@ -29,7 +29,7 @@ from .console import console
|
|||||||
|
|
||||||
|
|
||||||
# --> OS FILE ASCII
|
# --> OS FILE ASCII
|
||||||
special_chars_to_remove = ['!','@','#','$','%','^','&','*','(',')','[',']','{','}','<','|','`','~',"'",'"',';',':',',','?',"\\","/"]
|
special_chars_to_remove = ['!','@','#','$','%','^','&','*','(',')','[',']','{','}','<','|','`','~',"'",'"',';',':',',','?',"\\","/","\t"]
|
||||||
|
|
||||||
def get_max_length_by_os(system: str) -> int:
|
def get_max_length_by_os(system: str) -> int:
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user