Skip to content

RomySaputraSihananda/py_mediax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

py_mediax

py_mediax is a package that allows you to scrape Twitter to retrieve image URLs and info with specified URLs.

Getting Started

pip install py_mediax

Usage:

1. Get info

from py_mediax import Mediax;

data = Mediax.get("https://twitter.com/amortentia0213/status/1710162301326938255");

print(data);
Output
{
  "username": "@amortentia0213",
  "avatar": "https://pbs.twimg.com/profile_images/1651244772646854658/LssoZYlz_normal.jpg",
  "verified": false,
  "create_at": "2023-10-06T05:17:20.000Z",
  "tweet": "230929  #TGIFreday\n#Freya #프레야 #フレヤ #JKT48",
  "media": [
    {
      "url": "https://pbs.twimg.com/media/F7u3iB-boAAzYT9?format=jpg&name=4096x4096",
      "type": "image"
    },
    {
      "url": "https://pbs.twimg.com/media/F7u3iB-aQAAgrHo?format=jpg&name=4096x4096",
      "type": "image"
    },
    {
      "url": "https://pbs.twimg.com/media/F7u3iB8awAA1QOJ?format=jpg&name=4096x4096",
      "type": "image"
    }
  ],
  "views": "32.4K",
  "reposts": "371",
  "quotes": "5",
  "likes": "2,638",
  "bookmarks": "72"
}

2. Save media

from py_mediax import Mediax;

data = Mediax.save("data", "https://twitter.com/amortentia0213/status/1710162301326938255");

print(data);
Output
[
  {
    "url": "https://pbs.twimg.com/media/F7u3iB-boAAzYT9?format=jpg&name=4096x4096",
    "message": "save on data/F7u3iB-boAAzYT9.jpg"
  },
  {
    "url": "https://pbs.twimg.com/media/F7u3iB8awAA1QOJ?format=jpg&name=4096x4096",
    "message": "save on data/F7u3iB8awAA1QOJ.jpg"
  },
  {
    "url": "https://pbs.twimg.com/media/F7u3iB-aQAAgrHo?format=jpg&name=4096x4096",
    "message": "save on data/F7u3iB-aQAAgrHo.jpg"
  }
]
Sample image
  • data/F7u3iB-boAAzYT9.jpg

  • data/F7u3iB8awAA1QOJ.jpg

  • data/F7u3iB-aQAAgrHo.jpg


With py_mediax, you can easily access images from Twitter and integrate them into your projects. Be sure to comply with Twitter's usage rules and policies.

License

This project is licensed under the MIT License.

About

Scrape all media url from Twitter / X using python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages