Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/go-numb/x-post-to-blue
This Golang package provides long-form posting on Twitter Blue using the Playwright library.
https://github.com/go-numb/x-post-to-blue
go gui playwright post twitter x
Last synced: 7 days ago
JSON representation
This Golang package provides long-form posting on Twitter Blue using the Playwright library.
- Host: GitHub
- URL: https://github.com/go-numb/x-post-to-blue
- Owner: go-numb
- License: mit
- Created: 2024-02-06T05:27:09.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2024-09-02T04:35:02.000Z (2 months ago)
- Last Synced: 2024-10-15T11:59:54.263Z (22 days ago)
- Topics: go, gui, playwright, post, twitter, x
- Language: Go
- Homepage:
- Size: 109 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# X-POST-TO-BLUE
This Golang package provides long-form posting on Twitter Blue using the Playwright library.
### Installation
To use this package, you need to have Go installed. You can install it using the following command:
```bash
go get github.com/username/xpostblue# playwright
go run github.com/playwright-community/playwright-go/cmd/playwright@latest install --with-deps
# Or
go install github.com/playwright-community/playwright-go/cmd/playwright@latest
playwright install --with-deps
```### Usage
```go
package mainimport (
"github.com/username/x-post-to-blue"
)func main() {
// Create a new client
client := xpostblue.New(true)
// Close the client
defer client.Close()// Login to Twitter
err := client.Login("yourusername", "yourpassword")
if err != nil {
panic(err)
}// Post a message on Twitter
files := []string{"./images/1.jpg", "./images/2.jpg"}
err = client.Post(true, 5, "Hello, world! and long long-text", nil)
if err != nil {
panic(err)
}
}
```See [module test file](./mod_test.go) for details.
### Structs
- `ClientBody`: Main client struct containing Playwright instances and page methods
- `PostLocator`: Locator struct containing the elements for login and post sections### Methods
- `New(isHeadless bool) *ClientBody`: Initialize a new client
- `Close()`: Close the client and browser
- `Login(username, password string) error`: Login to Twitter
- `Post(isPost bool, sleepSecForUpload int, msg string, files []string) error`: Post a message on Twitter### Dependencies
- Playwright Go
- Zerolog### License
This package is released under the MIT License.For more information on Playwright Go, visit [https://github.com/mxschmitt/playwright-go](https://github.com/mxschmitt/playwright-go).
Feel free to contribute to this package by submitting issues or pull requests on GitHub.