StreamingCommunity 3.3.2__py3-none-any.whl → 3.3.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of StreamingCommunity might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: StreamingCommunity
3
- Version: 3.3.2
3
+ Version: 3.3.5
4
4
  Home-page: https://github.com/Arrowar/StreamingCommunity
5
5
  Author: Arrowar
6
6
  Project-URL: Bug Reports, https://github.com/Arrowar/StreamingCommunity/issues
@@ -78,43 +78,24 @@ Dynamic: requires-python
78
78
 
79
79
  ## Manual Installation
80
80
 
81
- <details>
82
- <summary>📝 Manual Installation & Update</summary>
83
-
84
- <details>
85
- <summary>📋 Requirements</summary>
86
-
87
- Prerequisites:
88
- * [Python](https://www.python.org/downloads/) > 3.8
89
- </details>
90
-
91
- <details>
92
81
  <summary>⚙️ Python Dependencies</summary>
93
82
 
94
- ```bash
95
- pip install -r requirements.txt
96
- ```
97
- </details>
98
-
99
- <details>
100
- <summary>🚀 Usage</summary>
101
-
102
83
  #### On Windows:
103
84
 
104
85
  ```powershell
105
- python test_run.py
86
+ pip install -r requirements.txt
106
87
  ```
107
88
 
108
89
  #### On Linux/MacOS:
109
90
 
110
91
  ```bash
111
- python3 test_run.py
92
+ pip3 install -r requirements.txt
93
+ # or alternatively:
94
+ python3 -m pip install -r requirements.txt
112
95
  ```
113
- </details>
114
96
 
115
- ## Update
116
-
117
- Keep your script up to date with the latest features by running:
97
+ <detail>
98
+ <summary> Update </summary>
118
99
 
119
100
  ### On Windows:
120
101
 
@@ -128,8 +109,6 @@ python update.py
128
109
  python3 update.py
129
110
  ```
130
111
 
131
- </details>
132
-
133
112
  ---
134
113
 
135
114
  ## Quick Start
@@ -161,7 +140,6 @@ python3 test_run.py
161
140
 
162
141
  ## Downloaders
163
142
 
164
- <details>
165
143
  <summary>📥 HLS</summary>
166
144
 
167
145
  Download HTTP Live Streaming (HLS) content from m3u8 URLs.
@@ -178,9 +156,7 @@ downloader.download()
178
156
  ```
179
157
 
180
158
  See [HLS example](./Test/EasyDownload//HLS.py) for complete usage.
181
- </details>
182
159
 
183
- <details>
184
160
  <summary>📽️ MP4</summary>
185
161
 
186
162
  Direct MP4 file downloader with support for custom headers and referrer.
@@ -197,9 +173,7 @@ downloader.download()
197
173
  ```
198
174
 
199
175
  See [MP4 example](./Test/EasyDownload/MP4.py) for complete usage.
200
- </details>
201
176
 
202
- <details>
203
177
  <summary>🧲 TOR</summary>
204
178
 
205
179
  Download content via torrent magnet links.
@@ -215,9 +189,7 @@ client.start_download()
215
189
  ```
216
190
 
217
191
  See [Torrent example](./Test/EasyDownload/TOR.py) for complete usage.
218
- </details>
219
192
 
220
- <details>
221
193
  <summary>🎞️ DASH</summary>
222
194
 
223
195
  ```python
@@ -239,19 +211,15 @@ dash_process.get_status()
239
211
  ```
240
212
 
241
213
  See [DASH example](./Test/EasyDownload/DASH.py) for complete usage.
242
- </details>
243
214
 
244
215
  ---
245
216
 
246
217
  ## Configuration
247
218
 
248
- <details>
249
219
  <summary>⚙️ Overview</summary>
250
220
 
251
221
  You can change some behaviors by tweaking the configuration file. The configuration file is divided into several main sections.
252
- </details>
253
222
 
254
- <details>
255
223
  <summary>📁 OUT_FOLDER</summary>
256
224
 
257
225
  ```json
@@ -287,9 +255,7 @@ You can change some behaviors by tweaking the configuration file. The configurat
287
255
 
288
256
  #### Additional Options
289
257
  - `add_siteName`: Appends site_name to root path (can be changed with `--add_siteName true/false`)
290
- </details>
291
258
 
292
- <details>
293
259
  <summary>🔄 QBIT_CONFIG Settings</summary>
294
260
 
295
261
  ```json
@@ -304,9 +270,7 @@ You can change some behaviors by tweaking the configuration file. The configurat
304
270
  ```
305
271
 
306
272
  To enable qBittorrent integration, follow the setup guide [here](https://github.com/lgallard/qBittorrent-Controller/wiki/How-to-enable-the-qBittorrent-Web-UI).
307
- </details>
308
273
 
309
- <details>
310
274
  <summary>📥 M3U8_DOWNLOAD Settings</summary>
311
275
 
312
276
  ```json
@@ -349,9 +313,7 @@ To enable qBittorrent integration, follow the setup guide [here](https://github.
349
313
 
350
314
  #### Cleanup
351
315
  - `cleanup_tmp_folder`: Remove temporary .ts files after download
352
- </details>
353
316
 
354
- <details>
355
317
  <summary>🔍 M3U8_PARSER Settings</summary>
356
318
 
357
319
  ```json
@@ -376,11 +338,9 @@ To enable qBittorrent integration, follow the setup guide [here](https://github.
376
338
  #### Link options
377
339
  - `get_only_link`: Return M3U8 playlist/index URL instead of downloading
378
340
 
379
- </details>
380
341
 
381
342
  ## Update Domains
382
343
 
383
- <details>
384
344
  <summary>🌐 Domain Configuration Methods</summary>
385
345
 
386
346
  There are two ways to manage the domains for the supported websites:
@@ -436,7 +396,6 @@ If online fetching fails, the script will automatically attempt to use the local
436
396
  #### 💡 Adding a New Site
437
397
  If you want to request a new site to be added to the repository, message us on the Discord server!
438
398
 
439
- </details>
440
399
 
441
400
  ---
442
401
 
@@ -498,13 +457,10 @@ StreamingCommunity --site streamingcommunity --search "interstellar" --auto-firs
498
457
 
499
458
  # Global Search
500
459
 
501
- <details>
502
460
  <summary>🔍 Feature Overview</summary>
503
461
 
504
462
  You can now search across multiple streaming sites at once using the Global Search feature. This allows you to find content more efficiently without having to search each site individually.
505
- </details>
506
463
 
507
- <details>
508
464
  <summary>🎯 Search Options</summary>
509
465
 
510
466
  When using Global Search, you have three ways to select which sites to search:
@@ -512,9 +468,7 @@ When using Global Search, you have three ways to select which sites to search:
512
468
  1. **Search all sites** - Searches across all available streaming sites
513
469
  2. **Search by category** - Group sites by their categories (movies, series, anime, etc.)
514
470
  3. **Select specific sites** - Choose individual sites to include in your search
515
- </details>
516
471
 
517
- <details>
518
472
  <summary>📝 Navigation and Selection</summary>
519
473
 
520
474
  After performing a search:
@@ -527,16 +481,13 @@ After performing a search:
527
481
  2. Select an item by number to view details or download
528
482
 
529
483
  3. The system will automatically use the appropriate site's API to handle the download
530
- </details>
531
484
 
532
- <details>
533
485
  <summary>⌨️ Command Line Arguments</summary>
534
486
 
535
487
  The Global Search can be configured from the command line:
536
488
 
537
489
  - `--global` - Perform a global search across multiple sites.
538
490
  - `-s`, `--search` - Specify the search terms.
539
- </details>
540
491
 
541
492
  ---
542
493
 
@@ -544,7 +495,6 @@ The Global Search can be configured from the command line:
544
495
 
545
496
  ## Hook/Plugin System
546
497
 
547
- <details>
548
498
  <summary>🧩 Run custom scripts before/after the main execution</summary>
549
499
 
550
500
  Define pre/post hooks in `config.json` under the `HOOKS` section. Supported types:
@@ -595,13 +545,11 @@ Notes:
595
545
 
596
546
  Hooks are executed automatically by `run.py` before (`pre_run`) and after (`post_run`) the main execution.
597
547
 
598
- </details>
599
548
 
600
549
  ---
601
550
 
602
551
  # Docker
603
552
 
604
- <details>
605
553
  <summary>🐳 Basic Setup</summary>
606
554
 
607
555
  Build the image:
@@ -619,9 +567,7 @@ Tip CLI:
619
567
  ```
620
568
  docker exec -it streaming-community python test_run.py
621
569
  ```
622
- </details>
623
570
 
624
- <details>
625
571
  <summary>💾 Custom Storage Location</summary>
626
572
 
627
573
  By default the videos will be saved in `/app/Video` inside the container. To save them on your machine:
@@ -629,9 +575,7 @@ By default the videos will be saved in `/app/Video` inside the container. To sav
629
575
  ```
630
576
  docker run -it --dns 9.9.9.9 -p 8000:8000 -v /path/to/download:/app/Video streaming-community-api
631
577
  ```
632
- </details>
633
578
 
634
- <details>
635
579
  <summary>🛠️ Quick Setup with Make</summary>
636
580
 
637
581
  Inside the Makefile (install `make`) are already configured two commands to build and run the container:
@@ -644,12 +588,10 @@ make LOCAL_DIR=/path/to/download run-container
644
588
  ```
645
589
 
646
590
  The `run-container` command mounts also the `config.json` file, so any change to the configuration file is reflected immediately without having to rebuild the image.
647
- </details>
648
591
 
649
592
 
650
593
  # Telegram Usage
651
594
 
652
- <details>
653
595
  <summary>⚙️ Basic Configuration</summary>
654
596
 
655
597
  The bot was created to replace terminal commands and allow interaction via Telegram. Each download runs within a screen session, enabling multiple downloads to run simultaneously.
@@ -679,9 +621,7 @@ TOKEN_TELEGRAM=IlTuo2131TOKEN$12D3Telegram
679
621
  AUTHORIZED_USER_ID=12345678
680
622
  DEBUG=False
681
623
  ```
682
- </details>
683
624
 
684
- <details>
685
625
  <summary>📥 Dependencies & Launch</summary>
686
626
 
687
627
  Install dependencies:
@@ -692,8 +632,7 @@ pip install -r requirements.txt
692
632
  Start the bot (from /StreamingCommunity/TelegramHelp):
693
633
  ```bash
694
634
  python3 telegram_bot.py
695
- ```
696
- </details>d
635
+ ```d
697
636
  - 🔹 `/list` – Displays the status of active downloads, with options to:
698
637
  - Stop an incorrect download using `/stop <ID>`
699
638
  - View the real-time output of a download using `/screen <ID>`
@@ -1,11 +1,8 @@
1
1
  StreamingCommunity/__init__.py,sha256=kOpFRfO3jz3gP2QjgPC_G85Z3rsMwMnsNa0POXMnDng,382
2
2
  StreamingCommunity/global_search.py,sha256=ip3D0OKNRTXHpe_Wy7v2KM-yNZdnnbG5FOBYSSk6wB8,12401
3
- StreamingCommunity/run.py,sha256=j1ez6hgVkVXW0hcw_nBYPUcXUr7BhjBWQCOsI4wlLPg,21108
4
- StreamingCommunity/Api/Player/ddl.py,sha256=cPinK99iX4ThvAHLlzcACcnFvM-M_NK0f4imh9PQY1I,2174
3
+ StreamingCommunity/run.py,sha256=dJ58oIeWaO5GZ1_zK0zVUBEwlD1k99YQihi0Y2dCzi0,21070
5
4
  StreamingCommunity/Api/Player/hdplayer.py,sha256=uQGU8ZVEk7qwwu1v4fjxScsP2x9NIHc7rRguXB1Fk2c,1942
6
- StreamingCommunity/Api/Player/maxstream.py,sha256=JlVTCAo9ze0wF2h0eNPYqdorhwK7DPXpmLAyHMnT7-Y,5017
7
5
  StreamingCommunity/Api/Player/mediapolisvod.py,sha256=Npm3HHUO5Wav8c2QX9E2c3SSW6d1STJw-kK8kHRF-zo,2403
8
- StreamingCommunity/Api/Player/mixdrop.py,sha256=rZOE14yFdQM0l7ZNRMzFtOpaedgXUo6gdvoBu24y7IE,5127
9
6
  StreamingCommunity/Api/Player/supervideo.py,sha256=AuAA6eXYODJN-ytdvKjqlzZLOHpwx3kwgy1CSiogs-o,5388
10
7
  StreamingCommunity/Api/Player/sweetpixel.py,sha256=AAdLSD7ASLuZNiBx6btr8S44WkxtjTiToPhjtgA6HAE,1703
11
8
  StreamingCommunity/Api/Player/vixcloud.py,sha256=0DnukAIBqGqTmL9I6JkpAkHLMf1UG1D_J8c7zt6KDmU,6609
@@ -67,12 +64,12 @@ StreamingCommunity/Api/Template/Util/__init__.py,sha256=v23VkosPNOQG5XbDkyCx5shE
67
64
  StreamingCommunity/Api/Template/Util/manage_ep.py,sha256=JMGLj_SJY-K5YuvKISurEYyS-pa9jZ2EA-lshVS73z0,9268
68
65
  StreamingCommunity/Lib/Downloader/__init__.py,sha256=Zh92xTvBIEIjNQN22iXItG7_VqiDGbOpO5gOZDBdGxc,288
69
66
  StreamingCommunity/Lib/Downloader/DASH/cdm_helpher.py,sha256=22kh7jvnhU-_mPM_EHgaDxurmAUuOLDc40DrZ2_3MN0,4037
70
- StreamingCommunity/Lib/Downloader/DASH/decrypt.py,sha256=y3F5zrED-FSQzwE9e5rTl07aWkg76qwFgxtziPpPVuQ,2352
67
+ StreamingCommunity/Lib/Downloader/DASH/decrypt.py,sha256=q5ARjb-wsJ0oxeNc-h8jB-LQjQH-idjHAE0ZP4hwNdg,2442
71
68
  StreamingCommunity/Lib/Downloader/DASH/downloader.py,sha256=W37W0X3NyVH0hu94I6qlipa7UvmDr-FQgaVd_DVgxy8,9519
72
69
  StreamingCommunity/Lib/Downloader/DASH/parser.py,sha256=QUyYhmu-zI2GieiNZaoOoDVPTclSKXsrdeToAtbC9yI,9858
73
70
  StreamingCommunity/Lib/Downloader/DASH/segments.py,sha256=oiip_q3QOY_c17_t66D0m974hyzsQXivhHY5-uE9dlQ,12747
74
71
  StreamingCommunity/Lib/Downloader/HLS/downloader.py,sha256=Q8NEvQ5HtxEhD8ZuCeaDkL6GMrag7uJYyHLoBqiM2t8,22130
75
- StreamingCommunity/Lib/Downloader/HLS/segments.py,sha256=SH1GCl4SObqqQoLiDwLDf3NTrjJoIgFby9Bqlt4s2Vo,17916
72
+ StreamingCommunity/Lib/Downloader/HLS/segments.py,sha256=9ICvzIPgS2RFPb8rvmioc-e5AsT07vAD8d-uC006bZ0,19425
76
73
  StreamingCommunity/Lib/Downloader/MP4/downloader.py,sha256=_z61uQVnlfh-ktWYTisfbg_a4C3tpK7MO8HUdgLhTpI,8060
77
74
  StreamingCommunity/Lib/Downloader/TOR/downloader.py,sha256=tYOCuKkKDcTIJ-2bGIeplovRkLTdp89i8lUvJs_N9jc,19133
78
75
  StreamingCommunity/Lib/FFmpeg/__init__.py,sha256=NZmOXpnc5jvdvjNnHPxvj5bzp0GUuNMXd00Fcy4rQPI,258
@@ -81,7 +78,7 @@ StreamingCommunity/Lib/FFmpeg/command.py,sha256=WNPBgEy9I2JRGbO_c4wZzmu0Knx2tx08
81
78
  StreamingCommunity/Lib/FFmpeg/util.py,sha256=enx5Z29A4aHkq09iaP80NVMttQn9PZ8ruGe6GvURjGk,9515
82
79
  StreamingCommunity/Lib/M3U8/__init__.py,sha256=Zxij4WFCxjwyfswUfBv0oys_o0vQpAL5PoK5TGG_StY,288
83
80
  StreamingCommunity/Lib/M3U8/decryptor.py,sha256=0VPMWbfwP9aEr4Y8OYi-e4o0ucMeCnV9HyuiOWxu_sE,2361
84
- StreamingCommunity/Lib/M3U8/estimator.py,sha256=S4pa4hBgtJsh11mmQcpQK_1_xhkb9fHrIZdfWBxEbAg,5592
81
+ StreamingCommunity/Lib/M3U8/estimator.py,sha256=5nwoB0ddw9S-2QryshZd0vTNaXpszGJCt5pYNSlumXw,5739
85
82
  StreamingCommunity/Lib/M3U8/parser.py,sha256=waHkNErWu-tnIJJvixVNjZ1R7OEtAWZDoTch-yey98M,22485
86
83
  StreamingCommunity/Lib/M3U8/url_fixer.py,sha256=0Wd6MsBf8BBQ6mmHFElgCX3UbHAzRzSREmi03yb4gU4,1735
87
84
  StreamingCommunity/Lib/TMBD/__init__.py,sha256=TBKZ0zwAUvil2V2AirEPy_Q-M3Ksar2CJsUNt4tpXhk,109
@@ -90,22 +87,23 @@ StreamingCommunity/Lib/TMBD/tmdb.py,sha256=QaYOskwBZbSejI0pG8h_pX4_7VNn9-3XZ3Nw6
90
87
  StreamingCommunity/TelegramHelp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
88
  StreamingCommunity/TelegramHelp/config.json,sha256=v7FjA4smyLWZxChATewmvxDjJcclOCRZ_BIFPJd8Jvc,1374
92
89
  StreamingCommunity/TelegramHelp/telegram_bot.py,sha256=KiurpTrgiUNyMcLfceseaxV4xGegCUSJ8YttSeGXhJM,26429
93
- StreamingCommunity/Upload/update.py,sha256=9DStkCA_GGHjf47eDjUe-YeQ2mXhjmY-6E5C-HAwPlo,3829
94
- StreamingCommunity/Upload/version.py,sha256=VIdob_GG5lK2o2JNNPRMMEGRaoqEvxlrW0-twh8JLpY,171
90
+ StreamingCommunity/Upload/update.py,sha256=ZSQEqNAGnD1yx-xIr-C0T3_zeQuyiIT0COxSLdb4m-Q,3831
91
+ StreamingCommunity/Upload/version.py,sha256=0X3dwtHdW0UC9gPDyEzpTxKd3PRAFIDdr-_oTEcFpIM,171
95
92
  StreamingCommunity/Util/color.py,sha256=NvD0Eni-25oOOkY-szCEoc0lGvzQxyL7xhM0RE4EvUM,458
96
93
  StreamingCommunity/Util/config_json.py,sha256=vB6o6J5V874_bp9Y87VCCxp2wig0P3vwz4--zVokH4o,28576
97
94
  StreamingCommunity/Util/headers.py,sha256=RP3A6Gr8UB8VU6uzw_yDOjEKkIFKpi7Gi6_w2ACxE30,292
98
95
  StreamingCommunity/Util/http_client.py,sha256=Z9537JZLoaPq3S9dfipe4nrWNL7QOyvxkqUlZHdSo40,6253
99
96
  StreamingCommunity/Util/logger.py,sha256=jexWdX8G7Sf3k5suyFNYlVXNgjsJjlAP5OrhGEQ8s0A,3069
100
97
  StreamingCommunity/Util/message.py,sha256=tstYQ9NxlfWupYkqPrOqOLqrKEb1iG5NsvIMNTUXXvA,1332
101
- StreamingCommunity/Util/os.py,sha256=7P9npCGIYVH-Ztn-r-8K0cuZwim773sW0vPedxISQLg,16232
98
+ StreamingCommunity/Util/os.py,sha256=b1lMbwPlHp-BVlsjN8XDmbzQmRrWvFG6HuWkFZVy6Co,12405
102
99
  StreamingCommunity/Util/table.py,sha256=xXfgd09oIYSxpJwnnkPZdWJ0DcCihSqxfvYYAEo-YMA,9806
103
- StreamingCommunity/Util/installer/bento4_install.py,sha256=Dq07e7ZAVQ_qWSvgsQY3rObcAUjv9cTBDTSQ95qRm9A,6182
100
+ StreamingCommunity/Util/installer/bento4_install.py,sha256=Cinufke4bqASzkpN_UUGXQetIFOklOzVJxNMJ0cSFqE,7428
104
101
  StreamingCommunity/Util/installer/binary_paths.py,sha256=-vo1sAavMBCg8u1Bx-CNhUIlWdQ7C2gcT2esVMSpKxs,2470
105
- StreamingCommunity/Util/installer/ffmpeg_install.py,sha256=33WT4I5ghc_Ung7m5mX5Kp_LiUk8NspVWnUekh8Xub0,13370
106
- streamingcommunity-3.3.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
107
- streamingcommunity-3.3.2.dist-info/METADATA,sha256=nOTwzL6cVuD_ajV-iwkniRQ8VrwItFdvehpLZ6h5FK0,20839
108
- streamingcommunity-3.3.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
109
- streamingcommunity-3.3.2.dist-info/entry_points.txt,sha256=Qph9XYfDC8n4LfDLOSl6gJGlkb9eFb5f-JOr_Wb_5rk,67
110
- streamingcommunity-3.3.2.dist-info/top_level.txt,sha256=YsOcxKP-WOhWpIWgBlh0coll9XUx7aqmRPT7kmt3fH0,19
111
- streamingcommunity-3.3.2.dist-info/RECORD,,
102
+ StreamingCommunity/Util/installer/device_install.py,sha256=yn4xR34lsE1PNRt0qlzhCTHZT_NibfdDEl4Q--b2pMQ,4459
103
+ StreamingCommunity/Util/installer/ffmpeg_install.py,sha256=iTj6MQRNWOz3mMtPLHnAALD1lwvBmG-LRM4o44bPRnQ,13638
104
+ streamingcommunity-3.3.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
105
+ streamingcommunity-3.3.5.dist-info/METADATA,sha256=8OpEmRMdF2Qp13MDHu3ovlHlwuYyr4RZIkjwdp15zgI,20148
106
+ streamingcommunity-3.3.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
107
+ streamingcommunity-3.3.5.dist-info/entry_points.txt,sha256=Qph9XYfDC8n4LfDLOSl6gJGlkb9eFb5f-JOr_Wb_5rk,67
108
+ streamingcommunity-3.3.5.dist-info/top_level.txt,sha256=YsOcxKP-WOhWpIWgBlh0coll9XUx7aqmRPT7kmt3fH0,19
109
+ streamingcommunity-3.3.5.dist-info/RECORD,,
@@ -1,82 +0,0 @@
1
- # 14.06.24
2
-
3
- import logging
4
-
5
-
6
- # External libraries
7
- import httpx
8
- from bs4 import BeautifulSoup
9
-
10
-
11
- # Internal utilities
12
- from StreamingCommunity.Util.config_json import config_manager
13
- from StreamingCommunity.Util.headers import get_userAgent
14
-
15
-
16
- # Variable
17
- max_timeout = config_manager.get_int("REQUESTS", "timeout")
18
- REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify')
19
-
20
-
21
- class VideoSource:
22
- def __init__(self, url, cookie) -> None:
23
- """
24
- Initializes the VideoSource object with default values.
25
- """
26
- self.headers = {'user-agent': get_userAgent()}
27
- self.url = url
28
- self.cookie = cookie
29
-
30
- def make_request(self, url: str) -> str:
31
- """
32
- Make an HTTP GET request to the provided URL.
33
-
34
- Parameters:
35
- - url (str): The URL to make the request to.
36
-
37
- Returns:
38
- - str: The response content if successful, None otherwise.
39
- """
40
- try:
41
- response = httpx.get(
42
- url=url,
43
- headers=self.headers,
44
- cookies=self.cookie,
45
- timeout=max_timeout,
46
- verify=REQUEST_VERIFY
47
- )
48
- response.raise_for_status()
49
-
50
- return response.text
51
-
52
- except Exception as err:
53
- logging.error(f"An error occurred: {err}")
54
-
55
- return None
56
-
57
- def get_playlist(self):
58
- """
59
- Retrieves the playlist URL from the video source.
60
-
61
- Returns:
62
- - tuple: The mp4 link if found, None otherwise.
63
- """
64
- try:
65
- text = self.make_request(self.url)
66
-
67
- if text:
68
- soup = BeautifulSoup(text, "html.parser")
69
- source = soup.find("source")
70
-
71
- if source:
72
- mp4_link = source.get("src")
73
- return mp4_link
74
-
75
- else:
76
- logging.error("No <source> tag found in the HTML.")
77
-
78
- else:
79
- logging.error("Failed to retrieve content from the URL.")
80
-
81
- except Exception as e:
82
- logging.error(f"An error occurred while parsing the playlist: {e}")
@@ -1,141 +0,0 @@
1
- # 05.07.24
2
- # NOTE: NOT USED
3
-
4
- import re
5
- import logging
6
-
7
-
8
- # External libraries
9
- import httpx
10
- import jsbeautifier
11
- from bs4 import BeautifulSoup
12
-
13
-
14
- # Internal utilities
15
- from StreamingCommunity.Util.config_json import config_manager
16
- from StreamingCommunity.Util.headers import get_userAgent
17
-
18
-
19
- # Variable
20
- MAX_TIMEOUT = config_manager.get_int("REQUESTS", "timeout")
21
- REQUEST_VERIFY = config_manager.get_bool('REQUESTS', 'verify')
22
-
23
- class VideoSource:
24
- def __init__(self, url: str):
25
- """
26
- Sets up the video source with the provided URL.
27
-
28
- Parameters:
29
- - url (str): The URL of the video.
30
- """
31
- self.url = url
32
- self.redirect_url = None
33
- self.maxstream_url = None
34
- self.m3u8_url = None
35
- self.headers = {'user-agent': get_userAgent()}
36
-
37
- def get_redirect_url(self):
38
- """
39
- Sends a request to the initial URL and extracts the redirect URL.
40
- """
41
- try:
42
- response = httpx.get(self.url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
43
- response.raise_for_status()
44
-
45
- # Extract the redirect URL from the HTML
46
- soup = BeautifulSoup(response.text, "html.parser")
47
- self.redirect_url = soup.find("div", id="iframen1").get("data-src")
48
- logging.info(f"Redirect URL: {self.redirect_url}")
49
-
50
- return self.redirect_url
51
-
52
- except Exception as e:
53
- logging.error(f"Error parsing HTML: {e}")
54
- raise
55
-
56
- def get_maxstream_url(self):
57
- """
58
- Sends a request to the redirect URL and extracts the Maxstream URL.
59
- """
60
- try:
61
- response = httpx.get(self.redirect_url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
62
- response.raise_for_status()
63
-
64
- # Extract the Maxstream URL from the HTML
65
- soup = BeautifulSoup(response.text, "html.parser")
66
- maxstream_url = soup.find("a")
67
-
68
- if maxstream_url is None:
69
-
70
- # If no anchor tag is found, try the alternative method
71
- logging.warning("Anchor tag not found. Trying the alternative method.")
72
- headers = {
73
- 'origin': 'https://stayonline.pro',
74
- 'user-agent': get_userAgent(),
75
- 'x-requested-with': 'XMLHttpRequest',
76
- }
77
-
78
- # Make request to stayonline api
79
- data = {'id': self.redirect_url.split("/")[-2], 'ref': ''}
80
- response = httpx.post('https://stayonline.pro/ajax/linkEmbedView.php', headers=headers, data=data, verify=REQUEST_VERIFY)
81
- response.raise_for_status()
82
- uprot_url = response.json()['data']['value']
83
-
84
- # Retry getting maxtstream url
85
- response = httpx.get(uprot_url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
86
- response.raise_for_status()
87
- soup = BeautifulSoup(response.text, "html.parser")
88
- maxstream_url = soup.find("a").get("href")
89
-
90
- else:
91
- maxstream_url = maxstream_url.get("href")
92
-
93
- self.maxstream_url = maxstream_url
94
- logging.info(f"Maxstream URL: {self.maxstream_url}")
95
-
96
- return self.maxstream_url
97
-
98
- except Exception as e:
99
- logging.error(f"Error during the request: {e}")
100
- raise
101
-
102
- def get_m3u8_url(self):
103
- """
104
- Sends a request to the Maxstream URL and extracts the .m3u8 file URL.
105
- """
106
- try:
107
- response = httpx.get(self.maxstream_url, headers=self.headers, follow_redirects=True, timeout=MAX_TIMEOUT, verify=REQUEST_VERIFY)
108
- response.raise_for_status()
109
- soup = BeautifulSoup(response.text, "html.parser")
110
-
111
- # Iterate over all script tags in the HTML
112
- for script in soup.find_all("script"):
113
- if "eval(function(p,a,c,k,e,d)" in script.text:
114
-
115
- # Execute the script using
116
- data_js = jsbeautifier.beautify(script.text)
117
-
118
- # Extract the .m3u8 URL from the script's output
119
- match = re.search(r'sources:\s*\[\{\s*src:\s*"([^"]+)"', data_js)
120
-
121
- if match:
122
- self.m3u8_url = match.group(1)
123
- logging.info(f"M3U8 URL: {self.m3u8_url}")
124
- break
125
-
126
- else:
127
- logging.error("Failed to find M3U8 URL: No match found")
128
-
129
- return self.m3u8_url
130
-
131
- except Exception as e:
132
- logging.error(f"Error executing the Node.js script: {e}")
133
- raise
134
-
135
- def get_playlist(self):
136
- """
137
- Executes the entire flow to obtain the final .m3u8 file URL.
138
- """
139
- self.get_redirect_url()
140
- self.get_maxstream_url()
141
- return self.get_m3u8_url()