Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ahmedelwerdany/blogger-image
Upload photos to your blog for free and fast. No API, no hassle, just your photos and your blog 🚀
https://github.com/ahmedelwerdany/blogger-image
blogger blogger-api image puppeteer upload upload-images
Last synced: 15 days ago
JSON representation
Upload photos to your blog for free and fast. No API, no hassle, just your photos and your blog 🚀
- Host: GitHub
- URL: https://github.com/ahmedelwerdany/blogger-image
- Owner: AhmedElwerdany
- License: mit
- Created: 2023-06-11T15:20:25.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-12-06T19:58:36.000Z (about 1 year ago)
- Last Synced: 2024-11-15T22:15:19.280Z (2 months ago)
- Topics: blogger, blogger-api, image, puppeteer, upload, upload-images
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/blogger-image
- Size: 308 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# blogger image
:arrow_up: blogger-image helps you upload photos to blogger using simple api
## install
```bash
npm i blogger-image
// or
yarn add blogger-image
```## Usage
```javascript
import Uploader from 'blogger-image'const POST_ID = "https://www.blogger.com/blog/post/edit/.../...";
const uploader = new Uploader(
POST_ID,
{
userDataDir: '/home/username/.config/chromium',
// it is recommended to use an old version of chromium instead of the default browser.
executablePath: '/home/username/.config/chrome-linux/chrome',
}
);
await uploader.init();const result = await Promise.all([
uploader.upload('./tree.png'),
]);console.log(result);
// the `upload` method will not be available after this.
uploader.close();
```
### kowen Issues
This package depends on `puppeteer`, which uses the latest version of Chromium.
The latest Chromium has problems with persistent login sessions, which may cause errors or unexpected behavior.
To avoid this, you need to use an old version on chromium and provide the "executablePath" option in your "new Uploader()" call, pointing to the path of the Chromium executable.Follow the next instructions if you want to download an older version of Chromium and use it with the package.
#### Download an Old version of Chromium
```shell
cd ~/.config
```
```shell
wget "https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F962947%2Fchrome-linux.zip?generation=1643115368404678&alt=media" -q --show-progress -O chrome_2f962947.zip
```
```shell
unzip chrome_2f962947.zip
```#### Login to Blogger
This will open the The version that we just downloaded.
```shell
cd chrome-linux; ./chrome
```
- Go to `blogger.com`
- Login
- Close the browser
```shell
pwd
```
Copy the result becuase you're gonna need it in `excutablePath`.
It should be `/home/{username}/.config/chrome-linux` where `{username}` is your username.Add it to the options.
```javascriptconst uploader = new Uploader(
POST_ID,
{
userDataDir: '/home/username/.config/chromium',
executablePath: '/home/username/.config/chrome-linux/chrome', // recomnded
}
);await uploader.init();
```