論文復現Part1.透過Python Selenium自動爬取Smashwords指定的免費風格小說(Romance:500篇/Horror:621篇)
Deep Learning-Based Short Story Generation for an Image Using the Encoder-Decoder Structure https://coolmandiary.blogspot.com/2026/03/deep-learning-based-short-story.html 這邊要注意Smashword要先註冊一個平台後 每一天有限制最多只能下載500本電子檔案,因此若超額就會下載失敗。 這時候手動瀏覽器自己去操作就會看到警示,要等隔天後再去下載。 預設存檔指定到Google Drive特定目錄,下次可以依照進度續Run。 使用到的套件有selenium pip install google-colab-selenium -q 透過網頁瀏覽操作可以觀察到網址等規則進行爬蟲 Romance https://www.smashwords.com/shelves/shelf/morefree/1235/free/medium Horror https://www.smashwords.com/shelves/shelf/morefree/874/free/medium 針對Romance分頁網址行為變化可以觀察到從0開始為第一頁後續依此類推。 https://www.smashwords.com/shelves/shelf/morefree/1235/free/medium/0 https://www.smashwords.com/shelves/shelf/morefree/1235/free/medium/1 https://www.smashwords.com/shelves/shelf/morefree/1235/free/medium/2 程式碼 這一個程式功能主要還可以斷點續RUN避免重複Call下載的網址,透過連上GoogleDrive判斷是否已經下載過了,約莫花了5分鐘就把論文原始的指定風格數量的電子書檔案下載下來了。 愛情(romance):500 篇 恐怖(horror):621 篇 成果就會是抓取指定數量的epub電子檔了