Lập trình , Thiết kế website, Auto Game Online

Visual Basic 6.0 – Chép file mp3 từ Chrome cache

1

Nguồn : Câu Lạc bộ VB https://www.caulacbovb.com/

Thủ thuật: Chép file mp3 từ Chrome cache
Tác giả:truongphu
Mô tả: Trình duyệt IE cho phép vào Temporary Internet Files để tìm file nhạc vừa nghe. Chrome thì toàn file f_000… trong cache!
Đương nhiên trong số file nầy, sẽ có file nhạc ta muốn. Thủ thuật nầy sẽ thực hiện điều đó


Cần trên Form: FileListbox tên mặc định là File1, Command1


Private Sub Command1_Click()
    Dim i&, FileName$, sTemp As String * 3, Rr%
    For i = 0 To File1.ListCount - 1
        FileName = File1.Path & "" & File1.List(i)
        If FileLen(FileName) > 3000000 Then
            Open FileName For Binary As #1
                Get #1, , sTemp
            Close #1
            If sTemp = "ID3" Then
                Randomize
                Rr = Rnd * 900 + 100
                FileCopy FileName, App.Path & "\Luu" & _
                Rr & Format(Now, "hhnnss") & ".mp3"
            End If
        End If
    Next
    MsgBox "Ðã xong"
End Sub
 
Private Sub Form_Load()
    File1.Path = "C\Documents and Settings\Administrator\Local Settings\Application Data\Google\Chrome\User Data\Default\Cache"
End Sub
  1. Private Sub Command1_Click()
  2.     Dim i&, FileName$, sTemp As String * 3, Rr%
  3.     For i = 0 To File1.ListCount – 1
  4.         FileName = File1.Path & “” & File1.List(i)
  5.         If FileLen(FileName) > 3000000 Then
  6.             Open FileName For Binary As #1
  7.                 Get #1, , sTemp
  8.             Close #1
  9.             If sTemp = “ID3” Then
  10.                 Randomize
  11.                 Rr = Rnd * 900 + 100
  12.                 FileCopy FileName, App.Path & “\Luu” & _
  13.                 Rr & Format(Now, “hhnnss”) & “.mp3”
  14.             End If
  15.         End If
  16.     Next
  17.     MsgBox “Ðã xong”
  18. End Sub
  19.  
  20. Private Sub Form_Load()
  21.     File1.Path = “C\Documents and Settings\Administrator\Local Settings\Application Data\Google\Chrome\User Data\Default\Cache”
  22. End Sub

GeSHi © Codebox Plus Extension

1- Form_Load sẽ cho path File1. Bạn có thể điều chỉnh path nầy cho phù hợp từng máy tùy phiên bản Windows và users.
2- If FileLen(FileName) > 3000000 Then: file nhạc mp3 tệ lắm cũng gần 3 MB
3- Get #1, , sTemp: chỉ đọc 3 byte đầu tiên dạng string
4- Randomize
Rr = Rnd * 900 + 100
VB6 chúng ghi file rất nhanh, trong 1 giây có thể copy, mở, ghi vài file lớn. Do đó để tự động đặt tên khỏi trùng, ta cho 3 ký tự số ngẫu nhiên ở đầu tên file.

Công việc sau đó chỉ là nghe xác định bài hát mong muốn, và rename lần nữa. Code dùng cho các loại file (đuôi)

Leave A Reply

Your email address will not be published.