├── APISample ├── plugin.yml └── src │ └── delion │ └── APISample │ ├── HttpAPI │ ├── Header.php │ └── Http.php │ ├── LobiAPI.php │ └── Main.php ├── LobiAPI ├── HttpAPI │ ├── Header.php │ └── Http.php └── LobiAPI.php └── README.md /APISample/plugin.yml: -------------------------------------------------------------------------------- 1 | name: APISample 2 | version: 0.1.0 3 | main: delion\APISample\Main 4 | description: LobiAPIを使用してLobiのプロフィールを指定したプロフィールに変更するサンプルプラグイン 5 | api: 1.10.0 6 | load: POSTWORLD 7 | author: delion 8 | 9 | -------------------------------------------------------------------------------- /APISample/src/delion/APISample/HttpAPI/Header.php: -------------------------------------------------------------------------------- 1 | Host = $host; 16 | return $this; 17 | } 18 | public function setConnection($connection){ 19 | $this->Connection = $connection; 20 | return $this; 21 | } 22 | public function setAccept($accept){ 23 | $this->Accept = $accept; 24 | return $this; 25 | } 26 | public function setUserAgent($useragent){ 27 | $this->UserAgent = $useragent; 28 | return $this; 29 | } 30 | public function setReferer($referer){ 31 | $this->Referer = $referer; 32 | return $this; 33 | } 34 | public function setAcceptEncoding($encoding){ 35 | $this->AcceptEncoding = $encoding; 36 | return $this; 37 | } 38 | public function setAcceptLanguage($language){ 39 | $this->AcceptLanguage = $language; 40 | return $this; 41 | } 42 | public function setOrigin($origin){ 43 | $this->Origin = $origin; 44 | return $this; 45 | } 46 | } -------------------------------------------------------------------------------- /APISample/src/delion/APISample/HttpAPI/Http.php: -------------------------------------------------------------------------------- 1 | cookie_path = $path; 13 | } 14 | 15 | public function get($url, $header){ 16 | $ch = curl_init($url); 17 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 18 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 19 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 20 | $req_header = []; 21 | if($header->Host != '') 22 | $req_header[] = 'Host: ' . $header->Host; 23 | if($header->Connection) 24 | $req_header[] = 'Connection: keep-alive'; 25 | if($header->Accept != '') 26 | $req_header[] = 'Accept: ' . $header->Accept; 27 | if($header->UserAgent != '') 28 | $req_header[] = 'User-Agent: ' . $header->UserAgent; 29 | if($header->Referer != '') 30 | $req_header[] = 'Referer: ' . $header->Referer; 31 | if($header->AcceptEncoding != '') 32 | $req_header[] = 'Accept-Encoding: ' . $header->AcceptEncoding; 33 | if($header->AcceptLanguage != '') 34 | $req_header[] = 'Accept-Language: ' . $header->AcceptLanguage; 35 | if(count($req_header) > 0) 36 | curl_setopt($ch, CURLOPT_HTTPHEADER, $req_header); 37 | curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookie_path); 38 | curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookie_path); 39 | $result = curl_exec($ch); 40 | curl_close($ch); 41 | return $result; 42 | } 43 | 44 | public function post($url, $data, $header){ 45 | $ch = curl_init($url); 46 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 47 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 48 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 49 | $req_header = []; 50 | if($header->Host != '') 51 | $req_header[] = 'Host: ' . $header->Host; 52 | if($header->Connection) 53 | $req_header[] = 'Connection: keep-alive'; 54 | if($header->Accept != '') 55 | $req_header[] = 'Accept: ' . $header->Accept; 56 | if($header->Origin != '') 57 | $req_header[] = 'Origin: ' . $header->Origin; 58 | if($header->UserAgent != '') 59 | $req_header[] = 'User-Agent: ' . $header->UserAgent; 60 | if($header->Referer != '') 61 | $req_header[] = 'Referer: ' . $header->Referer; 62 | if($header->AcceptEncoding != '') 63 | $req_header[] = 'Accept-Encoding: ' . $header->AcceptEncoding; 64 | if($header->AcceptLanguage != '') 65 | $req_header[] = 'Accept-Language: ' . $header->AcceptLanguage; 66 | curl_setopt($ch, CURLOPT_HTTPHEADER, $req_header); 67 | curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookie_path); 68 | curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookie_path); 69 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 70 | $result = curl_exec($ch); 71 | curl_close($ch); 72 | return $result; 73 | } 74 | } -------------------------------------------------------------------------------- /APISample/src/delion/APISample/LobiAPI.php: -------------------------------------------------------------------------------- 1 | NetworkAPI = new Http(); 12 | } 13 | 14 | public function Login($mail, $password){ 15 | $header1 = (new Header()) 16 | ->setAccept('text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8') 17 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 18 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 19 | 20 | $source = $this->NetworkAPI->get('https://lobi.co/signin', $header1); 21 | $csrf_token = Pattern::get_string($source, Pattern::$csrf_token, '"'); 22 | 23 | $post_data = sprintf('csrf_token=%s&email=%s&password=%s', $csrf_token, $mail, $password); 24 | $header2 = (new Header()) 25 | ->setAccept('text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8') 26 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 27 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 28 | 29 | return strpos($this->NetworkAPI->post('https://lobi.co/signin', $post_data, $header2), 'ログインに失敗しました') === false; 30 | } 31 | 32 | public function TwitterLogin($mail, $password){ 33 | $header1 = (new Header()) 34 | ->setAccept('text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8') 35 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 36 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 37 | 38 | $source = $this->NetworkAPI->get('https://lobi.co/signup/twitter', $header1); 39 | $authenticity_token = Pattern::get_string($source, Pattern::$authenticity_token, '"'); 40 | $redirect_after_login = Pattern::get_string($source, Pattern::$redirect_after_login, '"'); 41 | $oauth_token = Pattern::get_string($source, Pattern::$oauth_token, '"'); 42 | 43 | $post_data = 'authenticity_token=' . $authenticity_token . '&redirect_after_login=' . $redirect_after_login . '&oauth_token=' . $oauth_token . '&session%5Busername_or_email%5D=' . $mail . '&session%5Bpassword%5D=' . $password; 44 | $header2 = (new Header()) 45 | ->setAccept('text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8') 46 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 47 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 48 | 49 | $source2 = $this->NetworkAPI->post('https://api.twitter.com/oauth/authorize', $post_data, $header2); 50 | if(strpos($source, 'Twitterにログイン') !== false) 51 | return false; 52 | 53 | return strpos($this->NetworkAPI->get(Pattern::get_string($source, Pattern::$redirect_after_login, '"'), $header1), 'ログインに失敗しました') === false; 54 | } 55 | 56 | public function GetMe(){ 57 | $header = (new Header()) 58 | ->setAccept('application/json, text/plain, */*') 59 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 60 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 61 | 62 | return json_decode($this->NetworkAPI->get('https://web.lobi.co/api/me?fields=premium', $header), false); 63 | } 64 | 65 | public function GetPublicGroupList(){ 66 | $header = (new Header()) 67 | ->setAccept('application/json, text/plain, */*') 68 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 69 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 70 | 71 | $result = []; 72 | 73 | $index = 1; 74 | while(true){ 75 | $pg = json_decode($this->NetworkAPI->get("https://web.lobi.co/api/public_groups?count=1000&page=$index&with_archived=1", $header), false); 76 | $index++; 77 | if(count($pg[0]->items) == 0) 78 | break; 79 | foreach($pg as $pgbf) 80 | $result[] = $pg; 81 | } 82 | 83 | return $result; 84 | } 85 | 86 | public function GetPrivateGroupList(){ 87 | $header = (new Header()) 88 | ->setAccept('application/json, text/plain, */*') 89 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 90 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 91 | 92 | $result = []; 93 | 94 | $index = 1; 95 | while(true){ 96 | $pg = json_decode($this->NetworkAPI->get("https://web.lobi.co/api/groups?count=1000&page=$index", $header), false); 97 | $index++; 98 | if(count($pg[0]->items) == 0) 99 | break; 100 | foreach($pg as $pgbf) 101 | $result[] = $pg; 102 | } 103 | 104 | return $result; 105 | } 106 | 107 | public function GetNotifications(){ 108 | $header = (new Header()) 109 | ->setAccept('application/json, text/plain, */*') 110 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 111 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 112 | 113 | return json_decode($this->NetworkAPI->get('https://web.lobi.co/api/me?fields=premium', $header), false); 114 | } 115 | 116 | public function GetContacts($uid){ 117 | $header = (new Header()) 118 | ->setAccept('application/json, text/plain, */*') 119 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 120 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 121 | 122 | return json_decode($this->NetworkAPI->get("https://web.lobi.co/api/user/$uid/contacts", $header), false); 123 | } 124 | 125 | public function GetFollowers($uid){ 126 | $header = (new Header()) 127 | ->setAccept('application/json, text/plain, */*') 128 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 129 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 130 | 131 | return json_decode($this->NetworkAPI->get("https://web.lobi.co/api/user/$uid/followers", $header), false); 132 | } 133 | 134 | public function GetGroup($uid){ 135 | $header = (new Header()) 136 | ->setAccept('application/json, text/plain, */*') 137 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 138 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 139 | 140 | return json_decode($this->NetworkAPI->get("https://web.lobi.co/api/group/$uid?error_flavor=json2&fields=group_bookmark_info%2Capp_events_info", $header), false); 141 | } 142 | 143 | public function GetGroupMembersCount($uid){ 144 | $header = (new Header()) 145 | ->setAccept('application/json, text/plain, */*') 146 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 147 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 148 | 149 | $result = json_decode($this->NetworkAPI->get("https://web.lobi.co/api/group/$uid?error_flavor=json2&fields=group_bookmark_info%2Capp_events_info", $header), false); 150 | if(!isset($result->members_count)) 151 | return 0; 152 | if($result->members_count == null) 153 | return 0; 154 | return $result->members_count; 155 | } 156 | 157 | public function GetGroupMembers($uid){ 158 | $header = (new Header()) 159 | ->setAccept('application/json, text/plain, */*') 160 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 161 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 162 | 163 | $result = []; 164 | $next = '0'; 165 | $limit = 10000; 166 | while($limit-- > 0){ 167 | $g = json_decode($this->NetworkAPI->get("https://web.lobi.co/api/group/$uid?members_cursor=$next", $header), false); 168 | foreach($g->members as $m) 169 | $result[] = $m; 170 | if($g->members_next_cursor == 0) 171 | break; 172 | $next = $g->members_next_cursor; 173 | } 174 | 175 | return $result; 176 | } 177 | 178 | public function GetThreads($uid, $count = 20){ 179 | $header = (new Header()) 180 | ->setAccept('application/json, text/plain, */*') 181 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 182 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 183 | 184 | return json_decode($this->NetworkAPI->get("https://web.lobi.co/api/group/$uid/chats?count=$count", $header), false); 185 | } 186 | 187 | public function Goo($group_id, $chat_id){ 188 | $header = (new Header()) 189 | ->setAccept('application/json, text/plain, */*') 190 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 191 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 192 | 193 | $data = ['test'=>'test_content']; 194 | 195 | $this->NetworkAPI->post('https://web.lobi.co/api/group/$group_id/chats/like', $data, $header); 196 | } 197 | 198 | public function UnGoo($group_id, $chat_id){ 199 | $header = (new Header()) 200 | ->setAccept('application/json, text/plain, */*') 201 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 202 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 203 | 204 | $data = ['id' => $chat_id]; 205 | 206 | $this->NetworkAPI->post("https://web.lobi.co/api/group/$group_id/chats/unlike", $data, $header); 207 | } 208 | 209 | public function Boo($group_id, $chat_id){ 210 | $header = (new Header()) 211 | ->setAccept('application/json, text/plain, */*') 212 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 213 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 214 | 215 | $data = ['id' => $chat_id]; 216 | 217 | $this->NetworkAPI->post("https://web.lobi.co/api/group/$group_id/chats/boo", $data, $header); 218 | } 219 | 220 | public function UnBoo($group_id, $chat_id){ 221 | $header = (new Header()) 222 | ->setAccept('application/json, text/plain, */*') 223 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 224 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 225 | 226 | $data = ['id' => $chat_id]; 227 | 228 | $this->NetworkAPI->post("https://web.lobi.co/api/group/$group_id/chats/unboo", $data, $header); 229 | } 230 | 231 | public function Follow($user_id){ 232 | $header = (new Header()) 233 | ->setAccept('application/json, text/plain, */*') 234 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 235 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 236 | 237 | $data = ['users' => $user_id]; 238 | 239 | $this->NetworkAPI->post("https://web.lobi.co/api/me/contacts", $data, $header); 240 | } 241 | 242 | public function UnFollow($user_id){ 243 | $header = (new Header()) 244 | ->setAccept('application/json, text/plain, */*') 245 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 246 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 247 | 248 | $data = ['users' => $user_id]; 249 | 250 | $this->NetworkAPI->post("https://web.lobi.co/api/me/contacts/remove", $data, $header); 251 | } 252 | 253 | public function MakeThread($group_id, $message, $shout = false){ 254 | $header = (new Header()) 255 | ->setAccept('application/json, text/plain, */*') 256 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 257 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 258 | 259 | $data = [ 260 | 'type' => $shout ? 'shout' : 'normal', 261 | 'lang' => 'ja', 262 | 'message' => $message 263 | ]; 264 | 265 | $this->NetworkAPI->post("https://web.lobi.co/api/group/$group_id/chats", $data, $header); 266 | } 267 | 268 | public function Reply($group_id, $thread_id, $message){ 269 | $header = (new Header()) 270 | ->setAccept('application/json, text/plain, */*') 271 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 272 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 273 | 274 | $data = [ 275 | 'type' => 'normal', 276 | 'lang' => 'ja', 277 | 'message' => $message, 278 | 'reply_to' => $thread_id 279 | ]; 280 | 281 | $this->NetworkAPI->post("https://web.lobi.co/api/group/$group_id/chats", $data, $header); 282 | } 283 | 284 | public function MakePrivateGroup($user_id){ 285 | $header = (new Header()) 286 | ->setAccept('application/json, text/plain, */*') 287 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 288 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 289 | 290 | $data = ['user' => $user_id]; 291 | 292 | $this->NetworkAPI->post('https://web.lobi.co/api/groups/1on1s', $data, $header); 293 | } 294 | 295 | public function ChangeProfile($name, $description){ 296 | $header = (new Header()) 297 | ->setAccept('application/json, text/plain, */*') 298 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 299 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 300 | 301 | $data = [ 302 | 'name' => $name, 303 | 'description' => $description 304 | ]; 305 | 306 | $this->NetworkAPI->post("https://web.lobi.co/api/me/profile", $data, $header); 307 | } 308 | } 309 | 310 | class Pattern{ 311 | public static $csrf_token = 'setAccept('text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8') 26 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 27 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 28 | 29 | return strpos($this->NetworkAPI->post('https://lobi.co/signin', $post_data, $header2), 'ログインに失敗しました') === false; 30 | } 31 | 32 | public function TwitterLogin($mail, $password){ 33 | $header1 = (new Header()) 34 | ->setAccept('text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8') 35 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 36 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 37 | 38 | $source = $this->NetworkAPI->get('https://lobi.co/signup/twitter', $header1); 39 | $authenticity_token = Pattern::get_string($source, Pattern::$authenticity_token, '"'); 40 | $redirect_after_login = Pattern::get_string($source, Pattern::$redirect_after_login, '"'); 41 | $oauth_token = Pattern::get_string($source, Pattern::$oauth_token, '"'); 42 | 43 | $post_data = 'authenticity_token=' . $authenticity_token . '&redirect_after_login=' . $redirect_after_login . '&oauth_token=' . $oauth_token . '&session%5Busername_or_email%5D=' . $mail . '&session%5Bpassword%5D=' . $password; 44 | $header2 = (new Header()) 45 | ->setAccept('text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8') 46 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 47 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 48 | 49 | $source2 = $this->NetworkAPI->post('https://api.twitter.com/oauth/authorize', $post_data, $header2); 50 | if(strpos($source2, 'Twitterにログイン') !== false) 51 | return false; 52 | 53 | return strpos($this->NetworkAPI->get(Pattern::get_string($source2, Pattern::$twitter_redirect_to_lobi, '"'), $header1), 'ログインに失敗しました') === false; 54 | } 55 | 56 | public function GetMe(){ 57 | $header = (new Header()) 58 | ->setAccept('application/json, text/plain, */*') 59 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 60 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 61 | 62 | return json_decode($this->NetworkAPI->get('https://web.lobi.co/api/me?fields=premium', $header), false); 63 | } 64 | 65 | public function GetPublicGroupList(){ 66 | $header = (new Header()) 67 | ->setAccept('application/json, text/plain, */*') 68 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 69 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 70 | 71 | $result = []; 72 | 73 | $index = 1; 74 | while(true){ 75 | $pg = json_decode($this->NetworkAPI->get("https://web.lobi.co/api/public_groups?count=1000&page=$index&with_archived=1", $header), false); 76 | $index++; 77 | if(count($pg[0]->items) == 0) 78 | break; 79 | foreach($pg as $pgbf) 80 | $result[] = $pg; 81 | } 82 | 83 | return $result; 84 | } 85 | 86 | public function GetPrivateGroupList(){ 87 | $header = (new Header()) 88 | ->setAccept('application/json, text/plain, */*') 89 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 90 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 91 | 92 | $result = []; 93 | 94 | $index = 1; 95 | while(true){ 96 | $pg = json_decode($this->NetworkAPI->get("https://web.lobi.co/api/groups?count=1000&page=$index", $header), false); 97 | $index++; 98 | if(count($pg[0]->items) == 0) 99 | break; 100 | foreach($pg as $pgbf) 101 | $result[] = $pg; 102 | } 103 | 104 | return $result; 105 | } 106 | 107 | public function GetNotifications(){ 108 | $header = (new Header()) 109 | ->setAccept('application/json, text/plain, */*') 110 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 111 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 112 | 113 | return json_decode($this->NetworkAPI->get('https://web.lobi.co/api/info/notifications?platform=any', $header), false); 114 | } 115 | 116 | public function GetContacts($uid){ 117 | $header = (new Header()) 118 | ->setAccept('application/json, text/plain, */*') 119 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 120 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 121 | 122 | return json_decode($this->NetworkAPI->get("https://web.lobi.co/api/user/$uid/contacts", $header), false); 123 | } 124 | 125 | public function GetFollowers($uid){ 126 | $header = (new Header()) 127 | ->setAccept('application/json, text/plain, */*') 128 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 129 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 130 | 131 | return json_decode($this->NetworkAPI->get("https://web.lobi.co/api/user/$uid/followers", $header), false); 132 | } 133 | 134 | public function GetGroup($uid){ 135 | $header = (new Header()) 136 | ->setAccept('application/json, text/plain, */*') 137 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 138 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 139 | 140 | return json_decode($this->NetworkAPI->get("https://web.lobi.co/api/group/$uid?error_flavor=json2&fields=group_bookmark_info%2Capp_events_info", $header), false); 141 | } 142 | 143 | public function GetGroupMembersCount($uid){ 144 | $header = (new Header()) 145 | ->setAccept('application/json, text/plain, */*') 146 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 147 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 148 | 149 | $result = json_decode($this->NetworkAPI->get("https://web.lobi.co/api/group/$uid?error_flavor=json2&fields=group_bookmark_info%2Capp_events_info", $header), false); 150 | if(!isset($result->members_count)) 151 | return 0; 152 | if($result->members_count == null) 153 | return 0; 154 | return $result->members_count; 155 | } 156 | 157 | public function GetGroupMembers($uid){ 158 | $header = (new Header()) 159 | ->setAccept('application/json, text/plain, */*') 160 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 161 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 162 | 163 | $result = []; 164 | $next = '0'; 165 | $limit = 10000; 166 | while($limit-- > 0){ 167 | $g = json_decode($this->NetworkAPI->get("https://web.lobi.co/api/group/$uid?members_cursor=$next", $header), false); 168 | foreach($g->members as $m) 169 | $result[] = $m; 170 | if($g->members_next_cursor == 0) 171 | break; 172 | $next = $g->members_next_cursor; 173 | } 174 | 175 | return $result; 176 | } 177 | 178 | public function GetThreads($uid, $count = 20){ 179 | $header = (new Header()) 180 | ->setAccept('application/json, text/plain, */*') 181 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 182 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 183 | 184 | return json_decode($this->NetworkAPI->get("https://web.lobi.co/api/group/$uid/chats?count=$count", $header), false); 185 | } 186 | 187 | public function GetReplies($uid,$chatid){ 188 | $header = (new Header()) 189 | ->setAccept('application/json, text/plain, */*') 190 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 191 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 192 | 193 | return json_decode($this->NetworkAPI->get("https://web.lobi.co/api/group/$uid/chats/replies?to=$chatid", $header),true); 194 | } 195 | 196 | public function Goo($group_id, $chat_id){ 197 | $header = (new Header()) 198 | ->setAccept('application/json, text/plain, */*') 199 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 200 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 201 | 202 | $data = ['test'=>'test_content']; 203 | 204 | $this->NetworkAPI->post('https://web.lobi.co/api/group/$group_id/chats/like', $data, $header); 205 | } 206 | 207 | public function UnGoo($group_id, $chat_id){ 208 | $header = (new Header()) 209 | ->setAccept('application/json, text/plain, */*') 210 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 211 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 212 | 213 | $data = ['id' => $chat_id]; 214 | 215 | $this->NetworkAPI->post("https://web.lobi.co/api/group/$group_id/chats/unlike", $data, $header); 216 | } 217 | 218 | public function Boo($group_id, $chat_id){ 219 | $header = (new Header()) 220 | ->setAccept('application/json, text/plain, */*') 221 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 222 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 223 | 224 | $data = ['id' => $chat_id]; 225 | 226 | $this->NetworkAPI->post("https://web.lobi.co/api/group/$group_id/chats/boo", $data, $header); 227 | } 228 | 229 | public function UnBoo($group_id, $chat_id){ 230 | $header = (new Header()) 231 | ->setAccept('application/json, text/plain, */*') 232 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 233 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 234 | 235 | $data = ['id' => $chat_id]; 236 | 237 | $this->NetworkAPI->post("https://web.lobi.co/api/group/$group_id/chats/unboo", $data, $header); 238 | } 239 | 240 | public function Follow($user_id){ 241 | $header = (new Header()) 242 | ->setAccept('application/json, text/plain, */*') 243 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 244 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 245 | 246 | $data = ['users' => $user_id]; 247 | 248 | $this->NetworkAPI->post("https://web.lobi.co/api/me/contacts", $data, $header); 249 | } 250 | 251 | public function UnFollow($user_id){ 252 | $header = (new Header()) 253 | ->setAccept('application/json, text/plain, */*') 254 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 255 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 256 | 257 | $data = ['users' => $user_id]; 258 | 259 | $this->NetworkAPI->post("https://web.lobi.co/api/me/contacts/remove", $data, $header); 260 | } 261 | 262 | public function MakeThread($group_id, $message, $shout = false){ 263 | $header = (new Header()) 264 | ->setAccept('application/json, text/plain, */*') 265 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 266 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 267 | 268 | $data = [ 269 | 'type' => $shout ? 'shout' : 'normal', 270 | 'lang' => 'ja', 271 | 'message' => $message 272 | ]; 273 | 274 | $this->NetworkAPI->post("https://web.lobi.co/api/group/$group_id/chats", $data, $header); 275 | } 276 | 277 | public function Reply($group_id, $thread_id, $message){ 278 | $header = (new Header()) 279 | ->setAccept('application/json, text/plain, */*') 280 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 281 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 282 | 283 | $data = [ 284 | 'type' => 'normal', 285 | 'lang' => 'ja', 286 | 'message' => $message, 287 | 'reply_to' => $thread_id 288 | ]; 289 | 290 | $this->NetworkAPI->post("https://web.lobi.co/api/group/$group_id/chats", $data, $header); 291 | } 292 | 293 | public function MakePrivateGroup($user_id){ 294 | $header = (new Header()) 295 | ->setAccept('application/json, text/plain, */*') 296 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 297 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 298 | 299 | $data = ['user' => $user_id]; 300 | 301 | $this->NetworkAPI->post('https://web.lobi.co/api/groups/1on1s', $data, $header); 302 | } 303 | 304 | public function ChangeProfile($name, $description){ 305 | $header = (new Header()) 306 | ->setAccept('application/json, text/plain, */*') 307 | ->setUserAgent('Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36') 308 | ->setAcceptLanguage('ja,en-US;q=0.8,en;q=0.6'); 309 | 310 | $data = [ 311 | 'name' => $name, 312 | 'description' => $description 313 | ]; 314 | 315 | $this->NetworkAPI->post("https://web.lobi.co/api/me/profile", $data, $header); 316 | } 317 | } 318 | 319 | class Pattern{ 320 | public static $csrf_token = '