In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how python crawler solves the font encryption problems such as the number of fans and concerns of Kuaishou. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Want to take the number of fans, follow the description and so on.
Found that the font is encrypted. Elements is like this.
Cdn.nlark.com/yuque/0/2020/png/97322/1607128435174-179522d1-d962-494a-855c-5cb31f67d96b.png ">
The source code is like this.
After looking for js, it turned out to be used
Go to these things.
The one-to-one correspondence in this ttf is then drawn with js + css.
If you find the problem, fuck it.
Deduct the js? Use execjs to execute? It's so low.
Since you are a python, use python to rewrite it.
First use re to get the url of this ttf (because it changes every time)
Download this thing first, throw this ttf file into fonteditor, and then go.
Http://fontstore.baidu.com/static/editor/index.html
Look at it.
That's when I found something.
Isn't that what it is? if you find the corresponding relationship, then it's ok.
TTF files can not be done directly ah? What to do
Save as xml!
And then it becomes this thing, ok correspondence, and python can do it.
To write down the whole logic is
First get the ttf file, url request url to save, and then transfer to xml
Then take the special characters before encryption
# that's the thing, .
Then cut the corresponding OK and finish it.
Code for the corresponding relationship
According to what you saw, id: 0 said nothing.
It's been these things since 1: 15.
Upper code
# correspondence def kuaishou_un_font (soup Font_size): # soup is the font_dict of ttf transcoded into xml = {} for font_m in soup.glyphorder.children: if font_m! ='\ n' and 'humans' not in font_m: id = font_m.get (' id') name = font_m.get ('name') if id! =' 0' and int (id) < 11 : font_ [name] = str (int (id)-1) elif id ='11: font_ [name] ='.' Elif id = '1213: font_ [name] =' w' elif id ='13: elif id: font_ [name] ='14: font_ [name] ='m' elif id = ='15: font_ name] ='+' Size_dict = {} for font_k in soup.cmap_format_4.children: if 'map' in str (font_k): code = font_k.get (' code') [- 4:] name = font_k.get ('name') size_ codes [code] = name return font_ codes [size _ size]
Then take the TTF file and convert it to xml.
# TTF to XML font = TTFont ('font_size.ttf') font.saveXML (' font_size.xml')
After split, list goes to decrypt one by one.
# font_url changes every time font_url =''font_res = requests.get (font_url) with open (' font_size.ttf', 'wb+') as f: f.write (font_res.content) font = TTFont (' font_size.ttf') font.saveXML ('font_size.xml') soup = BeautifulSoup (open (' font_size.xml')) 'lxml') try: fan = user_data_json [' obfuseData'] ['fan'] [40 fan Mur8] .split (' & # x') fans =''for f in fan: fans + = kuaishou_un_font (soup, f) except: fans =''
Last
OK~ decoding completed
About python crawler how to solve the number of Kuaishou fans and concerns and other font encryption problems to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.