Nhiều bạn thích lấy link video để play trực tiếp trên VLC, tạo IPTV hoặc cho vào player nào đó để up lên web, nên mình làm bài hướng dẫn này.
Việc này cũng rất tiện khi bạn chia sẻ file, người khác bấm vô link là tải file về không phải qua nhiều bước. Tất cả các file trước khi lấy link thì bạn nhớ bật chia sẻ với quyền cho phép tải xuống (download).
GOOGLE DRIVE
Đây là link chia sẻ của một tập tin Google Drive, phần in đậm là id của file, mỗi file trên Google Drive đều có 1 id riêng:
https://drive.google.com/file/d/182LvFgnBhU-XU4RHNrWVcuxfOId3tedz/view?usp=sharing
Link tải trực tiếp sẽ có dạng:
https://drive.google.com/uc?export=download&confirm=f&id=<id file> Trong ví dụ link sẽ là: https://drive.google.com/uc?export=download&confirm=f&id=182LvFgnBhU-XU4RHNrWVcuxfOId3tedz
Một cách khác phức tạp hơn nhưng link lấy được sẽ ngon hơn là sử dụng Google Drive API Key, link có dạng:
https://www.googleapis.com/drive/v3/files/<id file>?alt=media&key=<API Key>&supportsAllDrives=True Trong ví dụ link sẽ là: https://www.googleapis.com/drive/v3/files/182LvFgnBhU-XU4RHNrWVcuxfOId3tedz?alt=media&key=AIzaSyAA9ERw-9LZVEohRYtCWka_TQc6oXmvcVU&supportsAllDrives=True
Làm thế nào để có API Key của riêng bạn? Truy cập https://console.cloud.google.com/apis/library/drive.googleapis.com
Nếu bạn chưa có tài khoản thì sẽ hiện ra như thế này:
Tiếp theo bấm Enable Google Drive API:
Sau khi Enable thành công. Bạn tìm và bấm vào mục Credentials bên thanh menu trái, sau đó chọn Create Credentials như hình:
ONEDRIVE
OneDrive cá nhân, trên giao diện web bấm chuột phải vào file chọn Embed như hình:
<iframe src="https://onedrive.live.com/embed?resid=90AF16FD855675C0%21100067&authkey=!APYUlLu3Vdk10S8" width="98" height="120" frameborder="0" scrolling="no"></iframe>
Trích xuất đường link trong src, đổi chữ embed thành download, ta có link tải trực tiếp có thể mở trên VLC:
https://onedrive.live.com/download?resid=90AF16FD855675C0%21100067&authkey=!APYUlLu3Vdk10S8
OneDrive Business, bạn chỉ cần thêm chữ ?download=1 vào cuối link là có ngay link trực tiếp:
https://33zmfk-my.sharepoint.com/:v:/g/personal/1_365_lucngoc_com/Ed5V68D1hpNKrnNEJ045bA0B9ybM3L4tVJEGmTUIGeQwXg?download=1
DROPBOX
Link Dropbox có dạng:
https://www.dropbox.com/s/kbe0ua5217042mo/Video.mov?dl=0
Đổi dl=0 thành dl=1 ta có link tải xuống trực tiếp:
https://www.dropbox.com/s/kbe0ua5217042mo/Video.mov?dl=1
Đổi dl=0 thành raw=1 ta có link mở file trực tiếp, link này có thể stream video trên VLC
https://www.dropbox.com/s/kbe0ua5217042mo/Video.mov?raw=1
Một cách khác là đổi chữ dropbox trong link thành dl.dropboxusercontent, ta có link dạng:
https://www.dl.dropboxusercontent.com/s/kbe0ua5217042mo/Video.mov?dl=0
BOX
Mở file của bạn trên trình duyệt, bạn sẽ nhìn thấy đường link trên thanh địa chỉ dạng:
https://app.box.com/file/1264503234167?s=at1jz6f57oxqfaroq4ro6fmdze7a4sk6
Hai tham số của đường link này:
- Shared Name: at1jz6f57oxqfaroq4ro6fmdze7a4sk6
- File ID: 1264503234167
Link trực tiếp sẽ có dạng (thay tham số vào phần in đậm tương ứng):
https://app.box.com/index.php?rm=box_download_shared_file&shared_name=at1jz6f57oxqfaroq4ro6fmdze7a4sk6&file_id=f_1264503234167