11
11
12
12
class VidStream (BaseExtractor ):
13
13
def _get_data (self ):
14
-
14
+
15
15
'''
16
16
Config:
17
17
List of servers. Will use servers in order.
@@ -28,30 +28,34 @@ def _get_data(self):
28
28
29
29
url = self .url .replace ('https:////' ,'https://' )
30
30
url = url .replace ('https://vidstreaming.io/download' ,'https://vidstreaming.io/server.php' )
31
-
32
31
soup = helpers .soupify (helpers .get (url ))
33
-
34
32
servers = Config ._read_config ()['siteconfig' ]['vidstream' ]['servers' ]
35
- sources_regex = r'sources:(\[{.*?}])'
36
- sources = re .search (sources_regex ,str (soup ))
37
33
38
34
linkserver = soup .select ('li.linkserver' )
39
35
for a in servers :
40
36
if a == 'vidstream' :
41
- return self ._get_link (sources )
37
+ return self ._get_link (soup )
42
38
for b in linkserver :
43
39
if b .get ('data-video' ).startswith (links .get (a ,'None' )):
44
- self .url = b .get ('data-video' )
45
- return extractors .get_extractor (a )._get_data (self )
40
+ """
41
+ Another class needs to get created instead of using self not to impact future loops
42
+ If the extractor fails vidstream.py will get run again with changed self
43
+ """
44
+ info = self .__dict__ .copy ()
45
+ info ['url' ] = b .get ('data-video' )
46
+ _self = Extractor (info )
47
+ return extractors .get_extractor (a )._get_data (_self )
46
48
47
- def _get_link (self ,sources ):
49
+ def _get_link (self ,soup ):
48
50
QUALITIES = {
49
51
"360" :[],
50
52
"480" :[],
51
53
"720" :[],
52
54
"1080" :[],
53
55
}
54
- sources = sources .group (1 )
56
+
57
+ sources_regex = r'sources:(\[{.*?}])'
58
+ sources = re .search (sources_regex ,str (soup )).group (1 )
55
59
sources = sources .replace ("'" ,'"' ) #json only accepts ""
56
60
57
61
regex = r"[{|,][\n]*?[ ]*?[\t]*?[A-z]*?[^\"]:"
@@ -75,3 +79,10 @@ def _get_link(self,sources):
75
79
'stream_url' : stream_url ,
76
80
'referer' : self .url
77
81
}
82
+
83
+
84
+ """dummy class to prevent changing self"""
85
+ class Extractor :
86
+ def __init__ (self , dictionary ):
87
+ for k , v in dictionary .items ():
88
+ setattr (self , k , v )
0 commit comments