这次咱加上了 tkinter 有界面了,输入要打开的文章个数,点击确定按钮就开始打开浏览器打开网页,我开了50个有点短暂消耗CPU
为了让好兄弟爱上学习,也许你可以给他打开100个
Python 无限窗口 打开自定义个浏览器窗口v3.0 exe版_懒笑翻的博客-CSDN博客


- """
- * @Author: xiaofang
- * @Description:
- 有界面了还差点味道,下一版本做成exe可执行文件
- """
- import webbrowser
- import tkinter as tk
-
- font = ("华文行楷", 20, "normal") # 正文格式
- title = ("华文行楷", 15, "normal") # 标题格式
- render = {}
- color = 'pink'
-
-
- class ReadArticle():
- def __init__(self, master):
- self.master = master
- self.master.config(width=50, height=12)
- self.face = tk.Frame(self.master)
- self.face.pack()
- text = '\n你想要看几篇CSDN文章\n'
- tk.Label(self.face, text=text, font=font).pack()
-
- self.namestr = tk.StringVar()
- tk.Entry(self.face, textvariable=self.namestr, font=font).pack(side=tk.TOP)
- tk.Button(self.face, text="确定", command=self.judge, bg=color).pack(side=tk.TOP)
-
- def judge(self):
- if int(self.namestr.get()) > 406:
- tk.messagebox.askokcancel(title='警告', message='最多有406篇文章,但是建议别一次性看太多')
- self.story_continue()
-
- def story_continue(self):
- Unlimited_windows(int(self.namestr.get()))
-
-
- def Unlimited_windows(page):
- # 这里有406个文章ID
- article_list = [126165573, 126147204, 126147135, 126147077, 126146991, 126146853, 126146809, 126146746, 126141444,
- 126138777, 126121828, 126120866, 126120586, 126111731, 126111484, 126111270, 126111057, 126110932,
- 126110513, 126109600, 126109531, 126109490, 126109450, 126109297, 126109269, 126109216, 126109178,
- 126109125, 125720009, 126107796, 126102545, 126064304, 126062766, 124771823, 126045496, 126042929,
- 126042588, 126024802, 126022922, 126022409, 126022015, 126021932, 126021659, 126001670, 125983539,
- 125983211, 125893833, 125892171, 125882287, 125880941, 125813467, 125802672, 125783705, 125774200,
- 125773853, 125773443, 125772881, 125772149, 125764746, 125745330, 125752177, 125751716, 125751480,
- 125548864, 125744106, 125743581, 125733185, 125733139, 125733083, 125733030, 125732705, 125685322,
- 125685288, 125685267, 125685237, 125685209, 125685171, 125685128, 125684926, 125668811, 125668671,
- 125609789, 125609669, 125609499, 125609008, 125607966, 125607771, 125607674, 125607516, 125606762,
- 125606537, 125586917, 125547886, 125303026, 125302497, 124992876, 124978832, 124947521, 124923036,
- 124879375, 124857251, 124848765, 124844943, 124844697, 124844266, 124842605, 124826958, 124804687,
- 108269121, 109450255, 79708933, 120291205, 114376799, 106865253, 108783685, 108812434, 124694014,
- 124675074, 124675908, 124675626, 124670179, 124558967, 124550286, 124546348, 124543300, 124544201,
- 124427538, 124500948, 124501554, 124488643, 124433871, 124433412, 124395660, 124391159, 124390208,
- 124382116, 124370395, 124369557, 124356627, 124354907, 124354045, 124333305, 124050497, 123908222,
- 123885987, 123873554, 123718542, 123646346, 120881415, 120273007, 120270399, 120270289, 118355791,
- 118355671, 115642448, 113702377, 110780925, 110246936, 110007322, 109902269, 109714538, 109713131,
- 109711980, 109711929, 109551892, 109449883, 109286009, 109268106, 109173032, 109021541, 108932186,
- 108929538, 108860807, 108818479, 108792270, 108706867, 108702945, 108491623, 108571831, 108571859,
- 108571848, 108563436, 108548714, 108443419, 108444310, 108443036, 108425467, 108392518, 108391313,
- 108373920, 108348088, 108347234, 108338523, 108308829, 108306910, 107837031, 107837006, 107837000,
- 107836987, 107836972, 107836966, 107836953, 107836935, 107836930, 107836922, 107828211, 107828193,
- 107828153, 107805343, 107805340, 107805335, 107805333, 107805327, 107805324, 107805320, 107805314,
- 107211375, 107147464, 107130701, 107131008, 107126651, 107126633, 107126472, 107126312, 107125866,
- 107125684, 107125673, 107125640, 107124536, 107117717, 107117683, 107117044, 107099821, 106979635,
- 106862326, 106801171, 106799232, 106794548, 106789692, 106767439, 106600054, 106599028, 106326233,
- 106320639, 106319465, 106188223, 106188108, 106131539, 106131376, 106103239, 106102336, 106101411,
- 106101142, 106080382, 105901143, 105875696, 79915291, 79245294, 104253188, 105594412, 105490606,
- 105501480, 104349839, 104300243, 104288959, 104266210, 104255407, 104242425, 104241653, 104230336,
- 104216872, 104214691, 104214470, 104213494, 104211757, 104191042, 104191047, 104191031, 104191029,
- 104191027, 104191012, 104191001, 104190095, 104177257, 104177162, 104177124, 104162749, 104162653,
- 104145515, 104138758, 104113689, 104109563, 104108478, 104108414, 104103879, 104092380, 104062937,
- 104055936, 104053185, 104043541, 104041812, 104001739, 103997425, 103964913, 103964665, 103958258,
- 103949767, 103943915, 103939536, 103939353, 103903617, 103736509, 103552496, 103550850, 103550259,
- 103504952, 103504917, 103504438, 103484833, 103472058, 103472001, 103469757, 103469729, 103469705,
- 103469671, 103469635, 103465020, 103464920, 103464650, 103464493, 103464432, 103463999, 103463990,
- 103433036, 103059693, 102763740, 102579506, 81914080, 80845985, 80693726, 80603179, 80602893,
- 80602888,
- 80602875, 80602862, 80602840, 80602804, 80410868, 80411173, 80410925, 80248860, 80223310, 80115250,
- 80111225, 80108026, 80105631, 80103980, 80075859, 79970060, 79908304, 79817790, 79743635, 79738799,
- 79724169, 79713625, 79460635, 79410381, 79390325, 79348889, 79314731, 79310659, 79309796, 79309504,
- 79295402, 79283417, 79282040, 79274112, 79272989, 79262958, 79257040, 79241532, 79236264, 79198690,
- 79192096, 79175593, 79158871, 79092521, 79067312, 79015561, 79010804, 79009535, 78778666, 78764087,
- 78764026, 78764007, 78763990, 78761531, 78760344, 78760082, 78759694, 78759018, 78755134, 78754900,
- 78754761, 78602975, 78599851]
-
- if page > 406:
- page = 406
- if page < 0:
- page = 1
- for i in range(0, page): # 打开100篇文章
- # time.sleep(1)
- webbrowser.open('https://lanxf.blog.csdn.net/article/details/' + str(article_list[i]))
-
-
- if __name__ == '__main__':
- root = tk.Tk()
- root.title('CSDN文章')
- ReadArticle(root)
- root.mainloop()