Compare commits
	
		
			3 Commits
		
	
	
		
			c131924577
			...
			7b0b830d64
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 7b0b830d64 | |||
| 1ba6c97f5a | |||
| c8cbfc7cb9 | 
@@ -6,6 +6,7 @@ from typing import List, Optional
 | 
				
			|||||||
from functools import lru_cache
 | 
					from functools import lru_cache
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from ..utils import output, BColors
 | 
				
			||||||
from ..utils.config import main_settings
 | 
					from ..utils.config import main_settings
 | 
				
			||||||
from ..utils.string_processing import fit_to_file_system
 | 
					from ..utils.string_processing import fit_to_file_system
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -204,9 +205,12 @@ class Cache:
 | 
				
			|||||||
        for path in self._dir.iterdir():
 | 
					        for path in self._dir.iterdir():
 | 
				
			||||||
            if path.is_dir():
 | 
					            if path.is_dir():
 | 
				
			||||||
                for file in path.iterdir():
 | 
					                for file in path.iterdir():
 | 
				
			||||||
 | 
					                    output(f"Deleting file {file}", color=BColors.GREY)
 | 
				
			||||||
                    file.unlink()
 | 
					                    file.unlink()
 | 
				
			||||||
 | 
					                output(f"Deleting folder {path}", color=BColors.HEADER)
 | 
				
			||||||
                path.rmdir()
 | 
					                path.rmdir()
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
 | 
					                output(f"Deleting folder {path}", color=BColors.HEADER)
 | 
				
			||||||
                path.unlink()
 | 
					                path.unlink()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.cached_attributes.clear()
 | 
					        self.cached_attributes.clear()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -549,6 +549,11 @@ class YoutubeMusic(SuperYouTube):
 | 
				
			|||||||
        return album
 | 
					        return album
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def fetch_lyrics(self, video_id: str, playlist_id: str = None) -> str:
 | 
					    def fetch_lyrics(self, video_id: str, playlist_id: str = None) -> str:
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        1. fetches the tabs of a song, to get the browse id
 | 
				
			||||||
 | 
					        2. finds the browse id of the lyrics
 | 
				
			||||||
 | 
					        3. fetches the lyrics with the browse id
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
        request_data = {
 | 
					        request_data = {
 | 
				
			||||||
            "context": {**self.credentials.context, "adSignalsInfo": {"params": []}},
 | 
					            "context": {**self.credentials.context, "adSignalsInfo": {"params": []}},
 | 
				
			||||||
            "videoId": video_id,
 | 
					            "videoId": video_id,
 | 
				
			||||||
@@ -575,6 +580,7 @@ class YoutubeMusic(SuperYouTube):
 | 
				
			|||||||
            pageType = traverse_json_path(tab, "tabRenderer.endpoint.browseEndpoint.browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType", default="")
 | 
					            pageType = traverse_json_path(tab, "tabRenderer.endpoint.browseEndpoint.browseEndpointContextSupportedConfigs.browseEndpointContextMusicConfig.pageType", default="")
 | 
				
			||||||
            if pageType in ("MUSIC_TAB_TYPE_LYRICS", "MUSIC_PAGE_TYPE_TRACK_LYRICS") or "lyrics" in pageType.lower():
 | 
					            if pageType in ("MUSIC_TAB_TYPE_LYRICS", "MUSIC_PAGE_TYPE_TRACK_LYRICS") or "lyrics" in pageType.lower():
 | 
				
			||||||
                browse_id = traverse_json_path(tab, "tabRenderer.endpoint.browseEndpoint.browseId", default=None)
 | 
					                browse_id = traverse_json_path(tab, "tabRenderer.endpoint.browseEndpoint.browseId", default=None)
 | 
				
			||||||
 | 
					                if browse_id is not None:
 | 
				
			||||||
                    break
 | 
					                    break
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if browse_id is None:
 | 
					        if browse_id is None:
 | 
				
			||||||
@@ -721,7 +727,6 @@ class YoutubeMusic(SuperYouTube):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        self.download_values_by_url[source.url] = {
 | 
					        self.download_values_by_url[source.url] = {
 | 
				
			||||||
            "url": _best_format.get("url"),
 | 
					            "url": _best_format.get("url"),
 | 
				
			||||||
            "chunk_size": _best_format.get("downloader_options", {}).get("http_chunk_size", main_settings["chunk_size"]),
 | 
					 | 
				
			||||||
            "headers": _best_format.get("http_headers", {}),
 | 
					            "headers": _best_format.get("http_headers", {}),
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user