Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the batch renaming function of bilibili Animation download Video by python

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "python how to achieve bilibili animation download video batch renaming function", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "python how to achieve bilibili animation download video batch renaming function" bar!

Bilib application

Download bilibili in the Microsoft Store. Although the software UI is ancient, the most important thing is to be stable and support downloading.

After installation, search for the video you want, and then cache the download

Enter the download path after download

Video file renaming

Open the automatic command program or py script, and select the path to download the video collection.

Select whether to add the serial number automatically

Finally, you can find the integrated video under the video of the download directory.

Packaged into exe program pyinstaller-F-w-I rename.ico rename.pypython script import osimport sysimport jsonimport shutilimport easyguiisIndex = Falsedef findname (path): with open (path,'r',encoding='utf-8') as load_f: load_dict = json.load (load_f) partno = load_dict ['PartNo'] partname = load_dict [' PartName'] print (type (partname)) return partno Partname def mkdir (path): # remove the first space path=path.strip () # remove the trailing\ symbol path=path.rstrip ("\") # determine whether the path exists # True # does not exist False isExists=os.path.exists (path) # judgment result if not isExists: # create a directory if it does not exist # create directory operation function os.makedirs (path) print (path + 'created successfully') return True else: # do not create a directory if it exists And prompt that the directory already exists print (path+' directory already exists') return Falsedef reorganizefile (mainpath,videopath): for fpathe,dirs,fs in os.walk (mainpath): # os.walk is to get all directories infofile = "" Mp4file= "" For f in fs: # # read the info file filename = os.path.join (fpathe,f) if filename.endswith (".info"): # determine whether it ends with "xxx" infofile = filename partno Partname = findname (infofile) if filename.endswith (".mp4"): mp4file = filename # # if if infofiles exist in both info files and mp4 files = "" and mp4fileholders = "": partno Partname = findname (infofile) if isIndex: partfile = partno+ "_" + partname+ ".mp4" else: partfile = partname+ ".mp4" changpath = os.path.join (videopath,partfile) shutil.move (mp4file,changpath) If _ _ name__ = = "_ main__": mainpath = easygui.diropenbox ("Video directory downloaded by bilibili", "Select directory"); if not mainpath: sys.exit () mainpath.strip (); if os.path.exists (mainpath): isIndex = easygui.ccbox ("whether to add sequence number before file name", "Select sequence number", choices= ("Yes", "No")) If not isIndex: sys.exit () videopath = os.path.join (mainpath, "video") mkdir (videopath) reorganizefile (mainpath,videopath) else: print ("wrong input path!") Thank you for your reading, the above is "python how to achieve bilibili animation download video batch renaming function" content, after the study of this article, I believe that python how to achieve bilibili animation download video batch renaming function of this problem has a deeper understanding, the specific use of the need for everyone to practice and verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report