Lady 0.1.3 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 031064723a3ce98b0f101d450bea3e50baae838cc69bc75cd8cffbd4f1a99676
4
- data.tar.gz: 39c433642e35faec8035bf916e2a09efa627430f2da08a01f79f98ea8d97c500
3
+ metadata.gz: '065918dbb078da687c66bddded56cfeceff89c60ad0045a743dc6d426ea9c179'
4
+ data.tar.gz: 796fe676a02b16c8a507e65ad5bb6df8b29c9cee7f2266d11aa4b9211f0fb93f
5
5
  SHA512:
6
- metadata.gz: 0413cc80f7d22937684bd0726f3bf94a8cdf18b039c21b4e7a13e671e2b9c05a94d09e61b1b0f579b1a84c36e56cd934ca5dce8fc21a204c9ba769f5b6a3648e
7
- data.tar.gz: e7088fa37148ce3922115800ae8fbdf3d3c24ccb03c1efb152d8ecc561761001388523e51c036c31184e3cc3f06222179b8ad79733690e2d5688e533224a0a7b
6
+ metadata.gz: c830257b8bf5059ab4707d94e80e81cc74036e1f3698ce2eeecc0384338e5b1c361a6accebeec139bebb7045fcf9993ff7a1ca0a40701d45c95b7f5850b567a8
7
+ data.tar.gz: c14af401517b20fc4676617edbef8367a20496f3262265d57b0b5e8506c61e175e55e9e7423cf976658ba5bfe53d3863367fb75ffa90684b61e7dbdeb3484ec3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Lady (0.1.3)
4
+ Lady (0.1.5)
5
5
  claide (~> 1.1.0)
6
6
  colored2 (~> 3.1.2)
7
7
  rest-client (~> 2.1.0)
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Lady
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/Lady`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ 通过抖音分享链接下载视频
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,22 +20,19 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
23
+ ```ruby
24
+ $ lady download "分享的文本"
25
+ ```
30
26
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
27
+ eg:
32
28
 
33
- ## Contributing
29
+ ```ruby
30
+ lady download "7.41 R@k.pD 11/23 sEH:/ 复制打开抖音,看看【大飞起来了的作品】Mreey Christmas 🎄 # 圣诞节 https://v.douyin.com/i8XdNDTV/"
31
+ ```
34
32
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/Lady. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/Lady/blob/master/CODE_OF_CONDUCT.md).
33
+ 默认会把视频保存到用户桌面
36
34
 
37
35
  ## License
38
36
 
39
37
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
38
 
41
- ## Code of Conduct
42
-
43
- Everyone interacting in the Lady project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/Lady/blob/master/CODE_OF_CONDUCT.md).
data/exe/lady CHANGED
@@ -4,4 +4,5 @@
4
4
  # 所以,当修改过lib文件下的代码,都需要重新执行
5
5
  # gem build *.gemspec 和 gem install *.gem 命令
6
6
  require 'Lady'
7
- Lady::Command.run(ARGV)
7
+ Lady::Command.run(ARGV)
8
+ # Lady::Command.run(['download', '5.89 c@N.JI WMJ:/ 06/12 复制打开抖音,看看【朦胧521的作品】 https://v.douyin.com/i8XmEK8n/'])
@@ -28,14 +28,17 @@ module Lady
28
28
  # 2.解析下载链接
29
29
  response = RestClient.get(ANALYSE_PREFIX + urls[0] , HEADERS)
30
30
  json_obj = JSON.parse(response)
31
+ nickname = json_obj['nickname'] ||= 'temp'
32
+ #puts json_obj
31
33
  video_url = json_obj['video']
32
34
  if video_url.length > 0
33
35
  # 3.下载
34
36
  video_data = RestClient.get(video_url)
35
- puts "下载完成".green
37
+ mkdir = FileUtils.mkdir_p('/Users/mac/Desktop/video')[0]
36
38
  # 4.写入本地
37
- file = File.open('/Users/mac/Desktop/video.mp4', 'a+')
39
+ file = File.open("#{mkdir}/#{nickname}.mp4", 'a+')
38
40
  if file
41
+ puts "保存成功!".green
39
42
  file.syswrite(video_data)
40
43
  end
41
44
  end
@@ -51,12 +54,12 @@ module Lady
51
54
  urls
52
55
  end
53
56
 
54
- # def validate!
55
- # super
56
- # unless @link
57
- # help! "link is necessary!"
58
- # end
59
- # end
57
+ def validate!
58
+ super
59
+ unless @link
60
+ help! "link is necessary!"
61
+ end
62
+ end
60
63
 
61
64
  end
62
65
 
data/lib/Lady/command.rb CHANGED
@@ -2,6 +2,7 @@ require 'claide'
2
2
  require 'colored2'
3
3
  require 'rest-client'
4
4
  require 'json'
5
+ require 'fileutils'
5
6
 
6
7
  module Lady
7
8
 
data/lib/Lady/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lady
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Lady
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - HZHCoder1990