Skip to content
조회 수 3180 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

python html tag 제거 경로 금지 문자 제거

 

 

from pytube import YouTube
 
# 경로 금지 문자 제거, HTML문자 제거
import re
def filename_remover(string):
        cleaner = re.compile('<.*?>|&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});') #<tag>, &nbsp 등등 제거
        string = re.sub(cleaner, '', string)
        while(string[-1] == '.'):
            string = string[:-1] #끝에 . 제거 ex) test... -> test
        non_directory_letter = ['/', ':', '*', '?', '<', '>', '|'] #경로 금지 문자열 제거
        for str_ in non_directory_letter:
                if str_ in string:
                        string = string.replace(str_, "")
        return string
 
url = 'https://www.youtube.com/watch?v=FbVeMmO6G60&t=1s'
yt = YouTube(url)
 
caption = yt.captions.all()[0]  # 첫번째 자막 선택
caption_xml=caption.xml_captions # html문서로 변환
re_string=filename_remover(caption_xml)
print(re_string)

 

 

로그인 후 댓글쓰기가 가능합니다.

?

  1. 11
    Feb 2023
    10:12

    chatGPT

    Category파이썬 Views4378
    Read More
  2. 21
    Apr 2023
    20:10

    DiffusionWrapper has 859.52 M params.

    Category파이썬 Views37378
    Read More
  3. 07
    May 2023
    04:17

    python AttributeError: 'WebDriver' object has no attribute 'find_element_by_css_selector' 해결방법

    Category파이썬 Views47497
    Read More
  4. 04
    Mar 2023
    08:39

    python class def

    Category파이썬 Views2366
    Read More
  5. 26
    Oct 2021
    05:59

    python html tag 제거 경로 금지 문자 제거

    Category파이썬 Views3180
    Read More
  6. 18
    Sep 2021
    09:46

    Python 메타블로그 글쓰기(제로보드, xpressengine blog api)

    Category파이썬 Views3433
    Read More
  7. 17
    Sep 2021
    08:43

    python 에서 구글 캘린더 api 이용하기(server to server)

    Category파이썬 Views3277
    Read More
  8. 22
    Jan 2022
    08:25

    pytube 사용방법

    Category파이썬 Views4189
    Read More
  9. 09
    Mar 2022
    22:45

    Visual Studio Code 파이썬 인터프리터 경로 변경하기

    Category파이썬 Views9265
    Read More
  10. 26
    Nov 2022
    10:31

    Windows용 Tesseract 설치 및 사용법

    Category파이썬 Views19468
    Read More
  11. 10
    Mar 2023
    14:09

    네이버 주식에서 종목의 투자정보 자료 가져오기

    Category파이썬 Views2244
    Read More
  12. 10
    Mar 2023
    14:33

    네이버 주식의 기업정보와 펀더멘탈정보 소스 가져오기

    Category파이썬 Views3366
    Read More
  13. 15
    Mar 2023
    04:01

    웹 페이지에서 동적으로 생성되는 데이터 가져오는 방법

    Category파이썬 Views6937
    Read More
  14. 08
    Jun 2022
    08:47

    자바스크립트 종말각?! HTML에서 파이썬 실행하는 PyScript 등장!

    Category파이썬 Views31256
    Read More
  15. 07
    Sep 2021
    19:56

    키움 증권 API를 이용하여 주식 자동 매매 프로그램 개발

    Category파이썬 Views3928
    Read More
  16. 06
    Sep 2021
    13:34

    키움증권 OpenAPI 당황스러움

    Category파이썬 Views1749
    Read More
  17. 13
    Sep 2021
    23:04

    키움증권 openAPI 지정가분할매수주문.py

    Category파이썬 Views3527
    Read More
  18. 11
    Sep 2021
    13:43

    파이썬 any, all 사용하기(배열데이터 안에 값이 하나라도 있는지 또는 모두 있는지 비교)

    Category파이썬 Views1956
    Read More
  19. 11
    Sep 2021
    13:47

    파이썬 datetime 모듈로 초간단 날짜 표현하기

    Category파이썬 Views2714
    Read More
  20. 13
    Sep 2021
    18:14

    파이썬 dictionary 딕셔너리 조작

    Category파이썬 Views2536
    Read More
Board Pagination Prev 1 2 3 Next
/ 3

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소