@@ -104,14 +104,15 @@ class LibgenFictionClient:
104104 def __init__ (self , mirror = None ):
105105
106106 MIRRORS = [
107+ "libgen.rs" ,
107108 "libgen.is" ,
108109 # "libgen.lc", # Still has the old-style search
109110 "gen.lib.rus.ec" ,
110111 "93.174.95.27" ,
111112 ]
112113
113114 if mirror is None :
114- self .base_url = "http://{}/fiction/" .format (random . choice ( MIRRORS ) )
115+ self .base_url = "http://{}/fiction/" .format (MIRRORS [ 0 ] )
115116 else :
116117 self .base_url = "http://{}/fiction/" .format (mirror )
117118
@@ -140,8 +141,7 @@ def get_detail_url(self, md5):
140141
141142 def get_download_url (self , md5 ):
142143 download_urls = [
143- 'http://93.174.95.29/fiction/{}' .format (md5 ),
144- 'https://libgen.lc/foreignfiction/ads.php?md5={}' .format (md5 )
144+ 'http://library.lol/fiction/{}' .format (md5 ),
145145 ]
146146
147147 for url in download_urls :
@@ -153,14 +153,17 @@ def get_download_url(self, md5):
153153 tree = etree .fromstring (html , parser )
154154
155155 SELECTOR = "//h2/a[contains(., 'GET')]"
156+ SELECTOR = "//a[contains(., 'GET')]"
156157 link = tree .xpath (SELECTOR )
157158 return link [0 ].get ('href' )
158159 except :
159160 continue
160161
161162if __name__ == "__main__" :
162163 client = LibgenFictionClient ()
163- search_results = client .search ("shadows on the grass " )
164+ search_results = client .search ("the count of monte cristo " )
164165
165- for result in search_results .results :
166+ for result in search_results .results [: 5 ] :
166167 print (result .title )
168+ print ("Detail" , client .get_detail_url (result .md5 ))
169+ print ("Download" , client .get_download_url (result .md5 ))
0 commit comments