From 48fbf7b0cd53ddaf88c943bc79b5bbe2f93ea4d7 Mon Sep 17 00:00:00 2001 From: zw963 Date: Fri, 12 May 2023 05:29:28 +0000 Subject: [PATCH] deploy: 8cf159b5b2636e479b0e27d460262c6370adfdf1 --- 404.html | 8 ++++---- Myip.html | 10 +++++----- index.html | 8 ++++---- index.json | 2 +- search-index.js | 2 +- toplevel.html | 16 ++++++++-------- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/404.html b/404.html index e74a6b2..3fcb1e1 100644 --- a/404.html +++ b/404.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - myip master + myip 0.4.4 @@ -39,7 +39,7 @@

- master + 0.4.4 diff --git a/Myip.html b/Myip.html index 8b2b8e7..2867ccd 100644 --- a/Myip.html +++ b/Myip.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - Myip - myip master + Myip - myip 0.4.4 @@ -39,7 +39,7 @@

- master + 0.4.4 @@ -101,7 +101,7 @@

- + myip/version.cr diff --git a/index.html b/index.html index 872f474..a72d324 100644 --- a/index.html +++ b/index.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - myip master + myip 0.4.4 @@ -39,7 +39,7 @@

- master + 0.4.4 diff --git a/index.json b/index.json index 71b0fcd..bf9f764 100644 --- a/index.json +++ b/index.json @@ -1 +1 @@ -{"repository_name":"myip","body":"# myip\n\n返回本机的公网 IP 以及访问外网的公网 IP,使用 http:/www.ip111.cn 以及 http://www.ip138.com 提供的服务。\n查看[文档](https://crystal-china.github.io/myip/)获取更多帮助\n\n```sh\n ╰─ $ bin/myip \nip111.cn:从国内测试:123.123.123.123 中国 北京市\nip138.com:您的iP地址是:[123.123.123.123 ] 来自:中国北京市西城区 联通\nip111.cn:从国外测试:111.111.111.111 美国 洛杉矶\nip111.cn:从谷歌测试:111.111.111.111 美国 洛杉矶\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","program":{"html_id":"myip/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"myip","program":true,"enum":false,"alias":false,"const":false,"class_methods":[{"html_id":"from_url(url:String,follow:Bool=false):Lexbor::Parser-class-method","name":"from_url","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"args_string":"(url : String, follow : Bool = false) : Lexbor::Parser","args_html":"(url : String, follow : Bool = false) : Lexbor::Parser","location":{"filename":"src/myip.cr","line_number":9,"url":"https://github.com/crystal-china/myip/blob/a6ffd2c76c59bc3e928f84d1e6330daeee1b7340/src/myip.cr#L9"},"def":{"name":"from_url","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"return_type":"Lexbor::Parser","visibility":"Public","body":"begin\n response = HTTP::Client.get(url)\n if response.status_code == 200\n Lexbor::Parser.new(response.body)\n else\n if follow && (response.status_code == 301)\n from_url(response.headers[\"Location\"], follow: true)\n else\n raise(ArgumentError.new(\"Host returned #{response.status_code}\"))\n end\n end\nrescue Socket::Error\n raise(Socket::Error.new(\"Host #{url} cannot be fetched\"))\nend"}},{"html_id":"get_ip_from_ib_sb(chan)-class-method","name":"get_ip_from_ib_sb","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":22,"url":"https://github.com/crystal-china/myip/blob/a6ffd2c76c59bc3e928f84d1e6330daeee1b7340/src/myip.cr#L22"},"def":{"name":"get_ip_from_ib_sb","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"https://api.ip.sb/geoip\"\n response = HTTP::Client.get(url)\n result = JSON.parse(response.body)\n io = IO::Memory.new\n PrettyPrint.format(result, io, 79)\n io.rewind\n chan.send({\"ip.sb/geoip:\", io.gets_to_end})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}},{"html_id":"get_ip_from_ip111(chan)-class-method","name":"get_ip_from_ip111","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":58,"url":"https://github.com/crystal-china/myip/blob/a6ffd2c76c59bc3e928f84d1e6330daeee1b7340/src/myip.cr#L58"},"def":{"name":"get_ip_from_ip111","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"begin\n ip111_url = \"http://www.ip111.cn\"\n doc = from_url(ip111_url, follow: true)\n iframe = (doc.nodes(\"iframe\")).map do |node|\n spawn do\n begin\n url = (node.attribute_by(\"src\")).not_nil!\n ip = (from_url(url)).body!.tag_text.strip\n title = (node.parent!.parent!.parent!.css(\".card-header\")).first.tag_text.strip\n chan.send({\"ip111.cn:#{title}:\", ip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\n end\n end\n {doc, iframe.size}\nrescue Socket::Error\n STDERR.puts(\"visit #{ip111_url} failed, please check internet connection.\")\n exit\nrescue ArgumentError\n STDERR.puts(\"#{ip111_url} return 500\")\n exit\nrescue ex\n STDERR.puts(ex.message)\n exit\nend"}},{"html_id":"get_ip_from_ip138(chan)-class-method","name":"get_ip_from_ip138","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":40,"url":"https://github.com/crystal-china/myip/blob/a6ffd2c76c59bc3e928f84d1e6330daeee1b7340/src/myip.cr#L40"},"def":{"name":"get_ip_from_ip138","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"http://www.ip138.com\"\n doc = from_url(url, follow: true)\n ip138_url = (doc.css(\"iframe\")).first.attribute_by(\"src\")\n url = \"http:#{ip138_url}\"\n doc = from_url(url)\n chan.send({\"ip138.com:\", (doc.css(\"body p\")).first.tag_text.strip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}}],"types":[{"html_id":"myip/Myip","path":"Myip.html","kind":"module","full_name":"Myip","name":"Myip","abstract":false,"locations":[{"filename":"src/myip/version.cr","line_number":1,"url":"https://github.com/crystal-china/myip/blob/a6ffd2c76c59bc3e928f84d1e6330daeee1b7340/src/myip/version.cr#L1"}],"repository_name":"myip","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/myip/myip/src/myip\\\"`).chomp.stringify }}"}]}]}} \ No newline at end of file +{"repository_name":"myip","body":"# myip\n\n返回本机的公网 IP 以及访问外网的公网 IP,使用 http:/www.ip111.cn 以及 http://www.ip138.com 提供的服务。\n查看[文档](https://crystal-china.github.io/myip/)获取更多帮助\n\n```sh\n ╰─ $ bin/myip \nip111.cn:从国内测试:123.123.123.123 中国 北京市\nip138.com:您的iP地址是:[123.123.123.123 ] 来自:中国北京市西城区 联通\nip111.cn:从国外测试:111.111.111.111 美国 洛杉矶\nip111.cn:从谷歌测试:111.111.111.111 美国 洛杉矶\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","program":{"html_id":"myip/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"myip","program":true,"enum":false,"alias":false,"const":false,"class_methods":[{"html_id":"from_url(url:String,follow:Bool=false):Lexbor::Parser-class-method","name":"from_url","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"args_string":"(url : String, follow : Bool = false) : Lexbor::Parser","args_html":"(url : String, follow : Bool = false) : Lexbor::Parser","location":{"filename":"src/myip.cr","line_number":9,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L9"},"def":{"name":"from_url","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"return_type":"Lexbor::Parser","visibility":"Public","body":"begin\n response = HTTP::Client.get(url)\n if response.status_code == 200\n Lexbor::Parser.new(response.body)\n else\n if follow && (response.status_code == 301)\n from_url(response.headers[\"Location\"], follow: true)\n else\n raise(ArgumentError.new(\"Host returned #{response.status_code}\"))\n end\n end\nrescue Socket::Error\n raise(Socket::Error.new(\"Host #{url} cannot be fetched\"))\nend"}},{"html_id":"get_ip_from_ib_sb(chan)-class-method","name":"get_ip_from_ib_sb","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":22,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L22"},"def":{"name":"get_ip_from_ib_sb","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"https://api.ip.sb/geoip\"\n response = HTTP::Client.get(url)\n result = JSON.parse(response.body)\n io = IO::Memory.new\n PrettyPrint.format(result, io, 79)\n io.rewind\n chan.send({\"ip.sb/geoip:\", io.gets_to_end})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}},{"html_id":"get_ip_from_ip111(chan)-class-method","name":"get_ip_from_ip111","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":58,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L58"},"def":{"name":"get_ip_from_ip111","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"begin\n ip111_url = \"http://www.ip111.cn\"\n doc = from_url(ip111_url, follow: true)\n iframe = (doc.nodes(\"iframe\")).map do |node|\n spawn do\n begin\n url = (node.attribute_by(\"src\")).not_nil!\n ip = (from_url(url)).body!.tag_text.strip\n title = (node.parent!.parent!.parent!.css(\".card-header\")).first.tag_text.strip\n chan.send({\"ip111.cn:#{title}:\", ip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\n end\n end\n {doc, iframe.size}\nrescue Socket::Error\n STDERR.puts(\"visit #{ip111_url} failed, please check internet connection.\")\n exit\nrescue ArgumentError\n STDERR.puts(\"#{ip111_url} return 500\")\n exit\nrescue ex\n STDERR.puts(ex.message)\n exit\nend"}},{"html_id":"get_ip_from_ip138(chan)-class-method","name":"get_ip_from_ip138","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":40,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L40"},"def":{"name":"get_ip_from_ip138","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"http://www.ip138.com\"\n doc = from_url(url, follow: true)\n ip138_url = (doc.css(\"iframe\")).first.attribute_by(\"src\")\n url = \"http:#{ip138_url}\"\n doc = from_url(url)\n chan.send({\"ip138.com:\", (doc.css(\"body p\")).first.tag_text.strip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}}],"types":[{"html_id":"myip/Myip","path":"Myip.html","kind":"module","full_name":"Myip","name":"Myip","abstract":false,"locations":[{"filename":"src/myip/version.cr","line_number":1,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip/version.cr#L1"}],"repository_name":"myip","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/myip/myip/src/myip\\\"`).chomp.stringify }}"}]}]}} \ No newline at end of file diff --git a/search-index.js b/search-index.js index 5404036..f423b34 100644 --- a/search-index.js +++ b/search-index.js @@ -1 +1 @@ -crystal_doc_search_index_callback({"repository_name":"myip","body":"# myip\n\n返回本机的公网 IP 以及访问外网的公网 IP,使用 http:/www.ip111.cn 以及 http://www.ip138.com 提供的服务。\n查看[文档](https://crystal-china.github.io/myip/)获取更多帮助\n\n```sh\n ╰─ $ bin/myip \nip111.cn:从国内测试:123.123.123.123 中国 北京市\nip138.com:您的iP地址是:[123.123.123.123 ] 来自:中国北京市西城区 联通\nip111.cn:从国外测试:111.111.111.111 美国 洛杉矶\nip111.cn:从谷歌测试:111.111.111.111 美国 洛杉矶\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","program":{"html_id":"myip/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"myip","program":true,"enum":false,"alias":false,"const":false,"class_methods":[{"html_id":"from_url(url:String,follow:Bool=false):Lexbor::Parser-class-method","name":"from_url","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"args_string":"(url : String, follow : Bool = false) : Lexbor::Parser","args_html":"(url : String, follow : Bool = false) : Lexbor::Parser","location":{"filename":"src/myip.cr","line_number":9,"url":"https://github.com/crystal-china/myip/blob/a6ffd2c76c59bc3e928f84d1e6330daeee1b7340/src/myip.cr#L9"},"def":{"name":"from_url","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"return_type":"Lexbor::Parser","visibility":"Public","body":"begin\n response = HTTP::Client.get(url)\n if response.status_code == 200\n Lexbor::Parser.new(response.body)\n else\n if follow && (response.status_code == 301)\n from_url(response.headers[\"Location\"], follow: true)\n else\n raise(ArgumentError.new(\"Host returned #{response.status_code}\"))\n end\n end\nrescue Socket::Error\n raise(Socket::Error.new(\"Host #{url} cannot be fetched\"))\nend"}},{"html_id":"get_ip_from_ib_sb(chan)-class-method","name":"get_ip_from_ib_sb","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":22,"url":"https://github.com/crystal-china/myip/blob/a6ffd2c76c59bc3e928f84d1e6330daeee1b7340/src/myip.cr#L22"},"def":{"name":"get_ip_from_ib_sb","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"https://api.ip.sb/geoip\"\n response = HTTP::Client.get(url)\n result = JSON.parse(response.body)\n io = IO::Memory.new\n PrettyPrint.format(result, io, 79)\n io.rewind\n chan.send({\"ip.sb/geoip:\", io.gets_to_end})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}},{"html_id":"get_ip_from_ip111(chan)-class-method","name":"get_ip_from_ip111","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":58,"url":"https://github.com/crystal-china/myip/blob/a6ffd2c76c59bc3e928f84d1e6330daeee1b7340/src/myip.cr#L58"},"def":{"name":"get_ip_from_ip111","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"begin\n ip111_url = \"http://www.ip111.cn\"\n doc = from_url(ip111_url, follow: true)\n iframe = (doc.nodes(\"iframe\")).map do |node|\n spawn do\n begin\n url = (node.attribute_by(\"src\")).not_nil!\n ip = (from_url(url)).body!.tag_text.strip\n title = (node.parent!.parent!.parent!.css(\".card-header\")).first.tag_text.strip\n chan.send({\"ip111.cn:#{title}:\", ip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\n end\n end\n {doc, iframe.size}\nrescue Socket::Error\n STDERR.puts(\"visit #{ip111_url} failed, please check internet connection.\")\n exit\nrescue ArgumentError\n STDERR.puts(\"#{ip111_url} return 500\")\n exit\nrescue ex\n STDERR.puts(ex.message)\n exit\nend"}},{"html_id":"get_ip_from_ip138(chan)-class-method","name":"get_ip_from_ip138","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":40,"url":"https://github.com/crystal-china/myip/blob/a6ffd2c76c59bc3e928f84d1e6330daeee1b7340/src/myip.cr#L40"},"def":{"name":"get_ip_from_ip138","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"http://www.ip138.com\"\n doc = from_url(url, follow: true)\n ip138_url = (doc.css(\"iframe\")).first.attribute_by(\"src\")\n url = \"http:#{ip138_url}\"\n doc = from_url(url)\n chan.send({\"ip138.com:\", (doc.css(\"body p\")).first.tag_text.strip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}}],"types":[{"html_id":"myip/Myip","path":"Myip.html","kind":"module","full_name":"Myip","name":"Myip","abstract":false,"locations":[{"filename":"src/myip/version.cr","line_number":1,"url":"https://github.com/crystal-china/myip/blob/a6ffd2c76c59bc3e928f84d1e6330daeee1b7340/src/myip/version.cr#L1"}],"repository_name":"myip","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/myip/myip/src/myip\\\"`).chomp.stringify }}"}]}]}}) \ No newline at end of file +crystal_doc_search_index_callback({"repository_name":"myip","body":"# myip\n\n返回本机的公网 IP 以及访问外网的公网 IP,使用 http:/www.ip111.cn 以及 http://www.ip138.com 提供的服务。\n查看[文档](https://crystal-china.github.io/myip/)获取更多帮助\n\n```sh\n ╰─ $ bin/myip \nip111.cn:从国内测试:123.123.123.123 中国 北京市\nip138.com:您的iP地址是:[123.123.123.123 ] 来自:中国北京市西城区 联通\nip111.cn:从国外测试:111.111.111.111 美国 洛杉矶\nip111.cn:从谷歌测试:111.111.111.111 美国 洛杉矶\n```\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","program":{"html_id":"myip/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"locations":[],"repository_name":"myip","program":true,"enum":false,"alias":false,"const":false,"class_methods":[{"html_id":"from_url(url:String,follow:Bool=false):Lexbor::Parser-class-method","name":"from_url","abstract":false,"args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"args_string":"(url : String, follow : Bool = false) : Lexbor::Parser","args_html":"(url : String, follow : Bool = false) : Lexbor::Parser","location":{"filename":"src/myip.cr","line_number":9,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L9"},"def":{"name":"from_url","args":[{"name":"url","external_name":"url","restriction":"String"},{"name":"follow","default_value":"false","external_name":"follow","restriction":"Bool"}],"return_type":"Lexbor::Parser","visibility":"Public","body":"begin\n response = HTTP::Client.get(url)\n if response.status_code == 200\n Lexbor::Parser.new(response.body)\n else\n if follow && (response.status_code == 301)\n from_url(response.headers[\"Location\"], follow: true)\n else\n raise(ArgumentError.new(\"Host returned #{response.status_code}\"))\n end\n end\nrescue Socket::Error\n raise(Socket::Error.new(\"Host #{url} cannot be fetched\"))\nend"}},{"html_id":"get_ip_from_ib_sb(chan)-class-method","name":"get_ip_from_ib_sb","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":22,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L22"},"def":{"name":"get_ip_from_ib_sb","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"https://api.ip.sb/geoip\"\n response = HTTP::Client.get(url)\n result = JSON.parse(response.body)\n io = IO::Memory.new\n PrettyPrint.format(result, io, 79)\n io.rewind\n chan.send({\"ip.sb/geoip:\", io.gets_to_end})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}},{"html_id":"get_ip_from_ip111(chan)-class-method","name":"get_ip_from_ip111","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":58,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L58"},"def":{"name":"get_ip_from_ip111","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"begin\n ip111_url = \"http://www.ip111.cn\"\n doc = from_url(ip111_url, follow: true)\n iframe = (doc.nodes(\"iframe\")).map do |node|\n spawn do\n begin\n url = (node.attribute_by(\"src\")).not_nil!\n ip = (from_url(url)).body!.tag_text.strip\n title = (node.parent!.parent!.parent!.css(\".card-header\")).first.tag_text.strip\n chan.send({\"ip111.cn:#{title}:\", ip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\n end\n end\n {doc, iframe.size}\nrescue Socket::Error\n STDERR.puts(\"visit #{ip111_url} failed, please check internet connection.\")\n exit\nrescue ArgumentError\n STDERR.puts(\"#{ip111_url} return 500\")\n exit\nrescue ex\n STDERR.puts(ex.message)\n exit\nend"}},{"html_id":"get_ip_from_ip138(chan)-class-method","name":"get_ip_from_ip138","abstract":false,"args":[{"name":"chan","external_name":"chan","restriction":""}],"args_string":"(chan)","args_html":"(chan)","location":{"filename":"src/myip.cr","line_number":40,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip.cr#L40"},"def":{"name":"get_ip_from_ip138","args":[{"name":"chan","external_name":"chan","restriction":""}],"visibility":"Public","body":"spawn do\n begin\n url = \"http://www.ip138.com\"\n doc = from_url(url, follow: true)\n ip138_url = (doc.css(\"iframe\")).first.attribute_by(\"src\")\n url = \"http:#{ip138_url}\"\n doc = from_url(url)\n chan.send({\"ip138.com:\", (doc.css(\"body p\")).first.tag_text.strip})\n rescue Socket::Error\n STDERR.puts(\"visit #{url} failed, please check internet connection.\")\n rescue ArgumentError\n STDERR.puts(\"#{url} return 500\")\n rescue ex\n STDERR.puts(ex.message)\n end\nend"}}],"types":[{"html_id":"myip/Myip","path":"Myip.html","kind":"module","full_name":"Myip","name":"Myip","abstract":false,"locations":[{"filename":"src/myip/version.cr","line_number":1,"url":"https://github.com/crystal-china/myip/blob/v0.4.4/src/myip/version.cr#L1"}],"repository_name":"myip","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/myip/myip/src/myip\\\"`).chomp.stringify }}"}]}]}}) \ No newline at end of file diff --git a/toplevel.html b/toplevel.html index d61bb11..5e388c0 100644 --- a/toplevel.html +++ b/toplevel.html @@ -3,8 +3,8 @@ - - + + @@ -13,7 +13,7 @@ - Top Level Namespace - myip master + Top Level Namespace - myip 0.4.4 @@ -39,7 +39,7 @@

- master + 0.4.4 @@ -172,7 +172,7 @@


@@ -188,7 +188,7 @@


@@ -204,7 +204,7 @@


@@ -220,7 +220,7 @@