In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces Python how to climb Wechat to achieve free reading, with a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Previously on...
I don't know if there are many friends who use Wechat to study. By the way, Amway here.
At present, when I read e-books, I am basically using Wechat to read books. After all, the infinite card smells good.
In Wechat reading, not only many genuine Python books can be read directly, but also you can read the notes written by others while reading.
But the unlimited card is not very friendly to the novel, so you can only read the first chapter, and the later chapter needs to be paid in disguise.
Although I know that tomato novels and seven cat novels can be read for free, I really don't want to have another software for a novel.
Fortunately, Wechat Reader has a function-you can upload books by yourself, and supports txt, pdf and epub formats.
This gives me an idea that I just need to download the novel locally and import it to Wechat to read.
The way to download novels is simple, use Python, or search for specially packaged downloaders. But I remember two years ago when I first learned Python, I practiced writing crawlers on the Pavilion of interest, so I turned it out and used it.
Crawling novel
The original code was found, but it was embarrassing that I crawled the website 404.
However, at present, the Pavilion of interest is everywhere, and it is not clear who is the "authentic" one.
There is also a relatively good news, many even web page templates are exactly the same, your crawler can change the address to continue to use, this is wonderful ah.
As a result, I casually found a "pen interest pavilion".
Today, let's take the Cangyuan map that I recently finished eating tomatoes as an example. We can see that on this Pavilion website, the URL of the novel Cangyuan map is url
Https://*********/html/2292/
At the same time, all the chapters of "Cang Yuan Map" are also listed on this page.
I think we should first crawl all the chapter names and corresponding url URLs and save them in the list. It is then crawled using requests and written to the txt document in turn.
The structure of the web page is not complex, and there are no anti-crawling measures. About 20 lines of code can be downloaded.
For I, j in zip (urls, names): res_text = requests.get (url Headers=header) .text zj_html = etree.HTML (res_text) texts = zj_html.xpath ('/ / * [@ id= "content"] / text ()') texts2 = zj_html.xpath ('/ / * [@ id= "content"] / * / text ()') text ='\ n'.join (texts). Strip () +'\ n'.join (texts2). Strip () with open ('novels_n.txt', 'a') Encoding='utf8') as f: f.write (f'{j}\ n {text}\ n') print (f'{novels_n} / {j}) Downloading.')
In this way, we crawled the novel "Cang Yuan Picture" and saved it as an txt document.
The title of the chapter is separated from the text by\ nThe text.
Whoring novels
The following steps are even easier, just click [send Book to Mobile phone] in the web version of Wechat Reader, and upload the "Cang Yuantu" you just crawled.
Import succeeded.
Click [read now] to enjoy the fruits of your labor.
There is nothing wrong with the whole paragraph and text.
Take a look at the chapter catalogue, it is also typesetting according to the normal catalogue.
It's perfect!
Thank you for reading this article carefully. I hope the article "how to climb Wechat to achieve free reading" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you to learn!
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.