twitter lib, description
This commit is contained in:
parent
04a73cb018
commit
6a6803f7e8
|
@ -6,7 +6,8 @@
|
||||||
"longman/telegram-bot": "dev-master",
|
"longman/telegram-bot": "dev-master",
|
||||||
"mremi/url-shortener": "dev-master",
|
"mremi/url-shortener": "dev-master",
|
||||||
"revolution/laravel-mastodon-api": "dev-master",
|
"revolution/laravel-mastodon-api": "dev-master",
|
||||||
"symfony/yaml": "^4.2@dev"
|
"symfony/yaml": "^4.2@dev",
|
||||||
|
"abraham/twitteroauth": "dev-master"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,8 +4,62 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "6903e9f20556c5d8505d2e29be759a61",
|
"content-hash": "6b935222c12b7c92375646b585f4c05a",
|
||||||
"packages": [
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "abraham/twitteroauth",
|
||||||
|
"version": "dev-master",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/abraham/twitteroauth.git",
|
||||||
|
"reference": "28697071d270f9336ab590c1716cc0237ffeb5ee"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/abraham/twitteroauth/zipball/28697071d270f9336ab590c1716cc0237ffeb5ee",
|
||||||
|
"reference": "28697071d270f9336ab590c1716cc0237ffeb5ee",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-curl": "*",
|
||||||
|
"php": "^5.6 || ^7.0 || ^7.1 || ^7.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpmd/phpmd": "~2.6",
|
||||||
|
"phpunit/phpunit": "~5.7",
|
||||||
|
"squizlabs/php_codesniffer": "~3.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Abraham\\TwitterOAuth\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Abraham Williams",
|
||||||
|
"email": "abraham@abrah.am",
|
||||||
|
"homepage": "https://abrah.am",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "The most popular PHP library for use with the Twitter OAuth REST API.",
|
||||||
|
"homepage": "https://twitteroauth.com",
|
||||||
|
"keywords": [
|
||||||
|
"Twitter API",
|
||||||
|
"Twitter oAuth",
|
||||||
|
"api",
|
||||||
|
"oauth",
|
||||||
|
"rest",
|
||||||
|
"social",
|
||||||
|
"twitter"
|
||||||
|
],
|
||||||
|
"time": "2018-07-04T01:28:41+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "aura/autoload",
|
"name": "aura/autoload",
|
||||||
"version": "2.x-dev",
|
"version": "2.x-dev",
|
||||||
|
@ -1368,7 +1422,8 @@
|
||||||
"longman/telegram-bot": 20,
|
"longman/telegram-bot": 20,
|
||||||
"mremi/url-shortener": 20,
|
"mremi/url-shortener": 20,
|
||||||
"revolution/laravel-mastodon-api": 20,
|
"revolution/laravel-mastodon-api": 20,
|
||||||
"symfony/yaml": 20
|
"symfony/yaml": 20,
|
||||||
|
"abraham/twitteroauth": 20
|
||||||
},
|
},
|
||||||
"prefer-stable": false,
|
"prefer-stable": false,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
|
|
21
run.php
21
run.php
|
@ -27,8 +27,8 @@ use Mremi\UrlShortener\Provider\Bitly\GenericAccessTokenAuthenticator;
|
||||||
|
|
||||||
$config = Yaml::parse(file_get_contents('config.yml'));
|
$config = Yaml::parse(file_get_contents('config.yml'));
|
||||||
|
|
||||||
var_dump($config['games']);
|
$games = $config['games'];
|
||||||
die();
|
krsort($games);
|
||||||
$pandoc = new \Pandoc\Pandoc();
|
$pandoc = new \Pandoc\Pandoc();
|
||||||
$bitlyProvider = new BitlyProvider(
|
$bitlyProvider = new BitlyProvider(
|
||||||
new GenericAccessTokenAuthenticator($config['BITLY_TOKEN'])
|
new GenericAccessTokenAuthenticator($config['BITLY_TOKEN'])
|
||||||
|
@ -46,8 +46,8 @@ if ($config['MASTODON'] === true) {
|
||||||
$mastodon = new MastodonClient($guzzle);
|
$mastodon = new MastodonClient($guzzle);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($source->games as $game) {
|
foreach ($games as $place => $game) {
|
||||||
$description = $game->text();
|
$description = $place.' место: '.$game;
|
||||||
if ($config['DRY_RUN']) {
|
if ($config['DRY_RUN']) {
|
||||||
echo $description."\n";
|
echo $description."\n";
|
||||||
continue;
|
continue;
|
||||||
|
@ -68,19 +68,8 @@ foreach ($source->games as $game) {
|
||||||
}
|
}
|
||||||
if ($config['MASTODON'] === true) {
|
if ($config['MASTODON'] === true) {
|
||||||
$mastodon->domain($config['MASTODON_SERVER'])->token($config['MASTODON_ACCESS_TOKEN']);
|
$mastodon->domain($config['MASTODON_SERVER'])->token($config['MASTODON_ACCESS_TOKEN']);
|
||||||
/*
|
|
||||||
if ($image) {
|
|
||||||
download('https://ifhub.club'.$image, './'.basename($image));
|
|
||||||
$attachment = $mastodon->post('/media', [
|
|
||||||
'file' => file_get_contents('./'.basename($image))
|
|
||||||
]);
|
|
||||||
var_dump($attachment);
|
|
||||||
unlink('./'.basename($image));
|
|
||||||
$mdescription .= $attachment->url;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
$mastodon->createStatus($description, [
|
$mastodon->createStatus($description, [
|
||||||
'language' => 'en'
|
'language' => 'ru'
|
||||||
]);
|
]);
|
||||||
if (!$config['DRY_RUN']) {
|
if (!$config['DRY_RUN']) {
|
||||||
file_put_contents('.lastrun', time());
|
file_put_contents('.lastrun', time());
|
||||||
|
|
Loading…
Reference in New Issue