@@ -7,7 +7,7 @@ use regex::Regex;
77
88use super :: utils:: is_url_host_and_has_path;
99use super :: { ExtractFrom , ExtractedVideo , Extractor , SupportedFrom } ;
10- use crate :: download:: get_page_text;
10+ use crate :: download:: { self , get_page_text} ;
1111
1212pub struct Doodstream ;
1313
@@ -16,7 +16,7 @@ impl Extractor for Doodstream {
1616 const NAMES : & ' static [ & ' static str ] = & [ "Doodstream" ] ;
1717
1818 fn supported_from ( ) -> SupportedFrom {
19- SupportedFrom :: all ( )
19+ SupportedFrom :: Url
2020 }
2121
2222 async fn supports_url ( url : & str ) -> Option < bool > {
@@ -34,10 +34,24 @@ impl Extractor for Doodstream {
3434 || is_url_host_and_has_path ( url, "dood.sh" , true , true )
3535 || is_url_host_and_has_path ( url, "dood.cx" , true , true )
3636 || is_url_host_and_has_path ( url, "dood.wf" , true , true )
37+ || is_url_host_and_has_path ( url, "dood.re" , true , true )
38+ || is_url_host_and_has_path ( url, "dood.one" , true , true )
39+ || is_url_host_and_has_path ( url, "dood.tech" , true , true )
40+ || is_url_host_and_has_path ( url, "dood.work" , true , true )
41+ || is_url_host_and_has_path ( url, "doods.pro" , true , true )
3742 || is_url_host_and_has_path ( url, "dooood.com" , true , true )
3843 || is_url_host_and_has_path ( url, "doodstream.com" , true , true )
44+ || is_url_host_and_has_path ( url, "doodstream.co" , true , true )
3945 || is_url_host_and_has_path ( url, "d000d.com" , true , true )
40- || is_url_host_and_has_path ( url, "d0000d.com" , true , true ) ,
46+ || is_url_host_and_has_path ( url, "d0000d.com" , true , true )
47+ || is_url_host_and_has_path ( url, "doodapi.com" , true , true )
48+ || is_url_host_and_has_path ( url, "d0o0d.com" , true , true )
49+ || is_url_host_and_has_path ( url, "do0od.com" , true , true )
50+ || is_url_host_and_has_path ( url, "dooodster.com" , true , true )
51+ || is_url_host_and_has_path ( url, "vidply.com" , true , true )
52+ || is_url_host_and_has_path ( url, "do7go.com" , true , true )
53+ || is_url_host_and_has_path ( url, "all3do.com" , true , true )
54+ || is_url_host_and_has_path ( url, "doply.net" , true , true ) ,
4155 )
4256 }
4357
@@ -47,28 +61,48 @@ impl Extractor for Doodstream {
4761 } ) ;
4862 const RANDOM_STRING_CHARS : & [ u8 ] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" . as_bytes ( ) ;
4963
50- let ( current_url, user_agent, fetch_referer) = match & from {
64+ // Extract current url info etc.
65+ let ( current_url, user_agent, current_referer) = match from {
5166 ExtractFrom :: Url {
5267 url,
5368 user_agent,
54- referer : _ ,
55- } => ( url. to_string ( ) , user_agent. clone ( ) , Some ( url . to_string ( ) ) ) ,
56- ExtractFrom :: Source ( _) => ( "https://dood.li/" . to_string ( ) , None , None ) ,
69+ referer,
70+ } => ( url, user_agent, referer ) ,
71+ ExtractFrom :: Source ( _) => anyhow :: bail! ( "Doodstream: from source is unsupported" ) ,
5772 } ;
5873 let current_url = url:: Url :: parse ( & current_url) . context ( "Doodstream: failed to retrieve sources" ) ?;
5974
60- let source = from. get_source ( None ) . await ?;
75+ // Resolve url and get text response
76+ let response = download:: get_response (
77+ None ,
78+ current_url,
79+ user_agent. as_deref ( ) ,
80+ current_referer. as_deref ( ) ,
81+ None ,
82+ )
83+ . await
84+ . context ( "Doodstream: failed to retrieve sources" ) ?
85+ . response ( ) ;
86+
87+ let resolved_url = response. url ( ) . clone ( ) ;
88+ let source = response
89+ . text ( )
90+ . await
91+ . context ( "Doodstream: failed to retrieve sources" ) ?;
92+
93+ // Extract video link
6194 let ( relative_fetch_url, token) = FETCH_REGEX
6295 . captures ( & source)
6396 . and_then ( |captures| captures. get ( 1 ) . zip ( captures. get ( 2 ) ) )
6497 . map ( |( m1, m2) | ( m1. as_str ( ) . to_string ( ) , m2. as_str ( ) . to_string ( ) ) )
6598 . context ( "Doodstream: failed to retrieve sources" ) ?;
6699
67100 let video_base_url = {
68- let fetch_url = current_url
101+ let fetch_url = resolved_url
69102 . join ( & relative_fetch_url)
70103 . context ( "Doodstream: failed to retrieve sources" ) ?;
71- get_page_text ( fetch_url, user_agent. as_deref ( ) , fetch_referer. as_deref ( ) , None )
104+ let fetch_referer = resolved_url. as_str ( ) . to_string ( ) ;
105+ get_page_text ( fetch_url, user_agent. as_deref ( ) , Some ( & fetch_referer) , None )
72106 . await
73107 . context ( "Doodstream: failed to retrieve sources" ) ?
74108 } ;
@@ -90,7 +124,7 @@ impl Extractor for Doodstream {
90124 } ;
91125
92126 let video_url = format ! ( "{video_base_url}{random_string}?token={token}&expiry={unix_time_millis}" ) ;
93- let video_url_referer = current_url
127+ let video_url_referer = resolved_url
94128 . join ( "/" )
95129 . context ( "Doodstream: failed to retrieve sources" ) ?;
96130
0 commit comments